Skip to content

Commit 87eb0bc

Browse files
authored
fix(notify): Fix the vertical offset issue of the notify component (#3689)
* fix(notify): 修复notify组件垂直偏移量问题单 * fix(notify): 修复e2e测试用例
1 parent 388976b commit 87eb0bc

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

examples/sites/demos/pc/app/notify/manual-close.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ test('手动关闭通知', async ({ page }) => {
1212
await buttons.nth(1).click()
1313
await buttons.nth(2).click()
1414

15-
await expect(notifys).toHaveCount(5)
15+
await expect(notifys).toHaveCount(3)
1616
await page.waitForTimeout(4100)
1717
await expect(notifys).toHaveCount(0)
1818
})

examples/sites/demos/pc/app/notify/verticalOffset.spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ import { test, expect } from '@playwright/test'
33
test('垂直方向偏离距离', async ({ page }) => {
44
page.on('pageerror', (exception) => expect(exception).toBeNull())
55
await page.goto('notify#verticalOffset')
6-
await page.getByRole('button', { name: '弹出提示框' }).click()
6+
7+
const demo = page.locator('#verticalOffset')
8+
await demo.getByRole('button', { name: '弹出提示框' }).click()
79
const notify = page.locator('.tiny-notify')
810
const offset = await notify.getAttribute('verticalOffset')
911
await expect(offset).toEqual('100')

packages/vue/src/notify/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ Notify.close = function (id: string, userOnClose?: (instance: NotifyInstance) =>
175175

176176
let removedPosition = instance.position
177177
let copys = instances.slice(index)
178-
let verticalOffset = 16
178+
let verticalOffset = instance.state.verticalOffset ? Number(instance.state.verticalOffset) : 16
179179

180180
instances
181181
.filter((item) => item.state.position === removedPosition)

0 commit comments

Comments
 (0)