forked from opentiny/tiny-vue
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(components): [drawer] enable open event (opentiny#1527)
* feat(drawer): enable open event * docs(drawer): enable open event * perf(drawer): enable open event * style(drawer): enable open event * perf(drawer): enable open event * perf(drawer): enable open event
- Loading branch information
Showing
7 changed files
with
102 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
examples/sites/demos/pc/app/drawer/open-event-composition-api.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<template> | ||
<div> | ||
<tiny-button @click="fn" type="primary"> 打开事件示例 </tiny-button> | ||
<tiny-drawer title="标题" :show-footer="true" :visible="visible" @update:visible="visible = $event" @open="open"> | ||
<div style="height: 200px; text-align: center"> | ||
<br /> | ||
<br /> | ||
<span>内容区域</span> | ||
</div> | ||
</tiny-drawer> | ||
</div> | ||
</template> | ||
|
||
<script setup> | ||
import { ref } from 'vue' | ||
import { Drawer as TinyDrawer, Button as TinyButton, Modal } from '@opentiny/vue' | ||
const visible = ref(false) | ||
function fn() { | ||
visible.value = true | ||
} | ||
function open() { | ||
Modal.message('打开事件') | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { test, expect } from '@playwright/test' | ||
|
||
test('打开事件', async ({ page }) => { | ||
page.on('pageerror', (exception) => expect(exception).toBeNull()) | ||
await page.goto('drawer#open-event') | ||
|
||
const message = page.locator('.tiny-modal.type__message').filter({ hasText: '打开事件' }).first() | ||
|
||
await page.getByRole('button', { name: '打开事件示例' }).click() | ||
await expect(message).toBeVisible() | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<template> | ||
<div> | ||
<tiny-button @click="fn" type="primary"> 打开事件示例 </tiny-button> | ||
<tiny-drawer title="标题" :show-footer="true" :visible="visible" @update:visible="visible = $event" @open="open"> | ||
<div style="height: 200px; text-align: center"> | ||
<br /> | ||
<br /> | ||
<span>内容区域</span> | ||
</div> | ||
</tiny-drawer> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import { Drawer, Button, Modal } from '@opentiny/vue' | ||
export default { | ||
components: { | ||
TinyDrawer: Drawer, | ||
TinyButton: Button | ||
}, | ||
data() { | ||
return { | ||
visible: false | ||
} | ||
}, | ||
methods: { | ||
fn() { | ||
this.visible = true | ||
}, | ||
open() { | ||
Modal.message('打开事件') | ||
} | ||
} | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters