forked from opentiny/tiny-vue
feat(switch): [switch] amend demo and API bug of switch (#1257)
* fix(switch): [switch] amend demo and api bug of switch * feat(switch): [switch] amend demo and API bug of switch * feat(switch): [switch] amend demo and API bug of switch
This commit is contained in:
parent
82c570c2c5
commit
684e6baa81
|
@ -5,5 +5,5 @@ title: Switch 开关
|
|||
# Switch 开关
|
||||
|
||||
<div>
|
||||
Switch 在两种状态间切换选择。
|
||||
在两种状态间切换选择。
|
||||
</div>
|
||||
|
|
|
@ -5,5 +5,5 @@ title: Switch 开关
|
|||
# Switch 开关
|
||||
|
||||
<div>
|
||||
Switch 在两种状态间切换选择。
|
||||
在两种状态间切换选择。
|
||||
</div>
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
---
|
||||
title: Switch 开关
|
||||
title: Switch 开关
|
||||
---
|
||||
|
||||
# Switch 开关
|
||||
# Switch 开关
|
||||
|
||||
<div>
|
||||
|
||||
Switch 在两种状态间切换选择。
|
||||
在两种状态间切换选择。
|
||||
|
||||
</div>
|
||||
|
||||
|
|
|
@ -9,7 +9,10 @@ import { Switch as TinySwitch, Modal } from '@opentiny/vue'
|
|||
const value = ref(false)
|
||||
|
||||
function beforeChange(done) {
|
||||
Modal.message('开关切换功能已被拦截,必须调用 done 方法才能执行开关状态的切换,2s后将自动调用 done 方法切换开关状态')
|
||||
Modal.message({
|
||||
message: '开关切换功能已被拦截,必须调用 done 方法才能执行开关状态的切换,2s后将自动调用 done 方法切换开关状态',
|
||||
status: 'info'
|
||||
})
|
||||
setTimeout(done, 2000)
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -16,9 +16,10 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
beforeChange(done) {
|
||||
Modal.message(
|
||||
'开关切换功能已被拦截,必须调用 done 方法才能执行开关状态的切换,2s后将自动调用 done 方法切换开关状态'
|
||||
)
|
||||
Modal.message({
|
||||
message: '开关切换功能已被拦截,必须调用 done 方法才能执行开关状态的切换,2s后将自动调用 done 方法切换开关状态',
|
||||
status: 'info'
|
||||
})
|
||||
setTimeout(done, 2000)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<div>
|
||||
<tiny-switch v-model="value" true-value="yes" false-value="no"> </tiny-switch>
|
||||
当前值:{{ value }}
|
||||
当前值: {{ value }}
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ test('自定义开关取值', async ({ page }) => {
|
|||
const demo = page.locator('#custom-true-false-value')
|
||||
const switchBtn = demo.locator('.tiny-switch')
|
||||
|
||||
await expect(demo.locator('.pc-demo')).toHaveText('当前值:yes')
|
||||
await expect(demo.locator('.pc-demo')).toHaveText('当前值: yes')
|
||||
await switchBtn.click()
|
||||
await expect(demo.locator('.pc-demo')).toHaveText('当前值:no')
|
||||
await expect(demo.locator('.pc-demo')).toHaveText('当前值: no')
|
||||
})
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<div>
|
||||
<tiny-switch v-model="value" true-value="yes" false-value="no"> </tiny-switch>
|
||||
当前值:{{ value }}
|
||||
当前值: {{ value }}
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
|
@ -6,6 +6,6 @@
|
|||
import { Switch as TinySwitch, Modal } from '@opentiny/vue'
|
||||
|
||||
function handleChange(val) {
|
||||
Modal.message({ message: `开关值:${val}` })
|
||||
Modal.message({ message: `开关值:${val}`, status: 'info' })
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -11,7 +11,7 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
handleChange(val) {
|
||||
Modal.message({ message: `开关值:${val}` })
|
||||
Modal.message({ message: `开关值:${val}`, status: 'info' })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,4 +4,4 @@ title: Switch 开关
|
|||
|
||||
# Switch 开关
|
||||
|
||||
<div>Switch 在两种状态间切换选择。</div>
|
||||
<div>在两种状态间切换选择。</div>
|
||||
|
|
Loading…
Reference in New Issue