From 684e6baa817e04947da467b59495d21ab6bf01e8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=8E=E5=A4=A9=E4=BD=91?=
<66231260+You-Hw-Y@users.noreply.github.com>
Date: Fri, 5 Jan 2024 00:41:12 -0800
Subject: [PATCH] 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
---
.../demos/mobile-first/app/switch/webdoc/switch.cn.md | 2 +-
.../demos/mobile-first/app/switch/webdoc/switch.en.md | 2 +-
examples/sites/demos/mobile/app/switch/webdoc/switch.cn.md | 7 +++----
.../demos/pc/app/switch/before-change-composition-api.vue | 5 ++++-
examples/sites/demos/pc/app/switch/before-change.vue | 7 ++++---
.../app/switch/custom-true-false-value-composition-api.vue | 2 +-
.../demos/pc/app/switch/custom-true-false-value.spec.ts | 4 ++--
.../sites/demos/pc/app/switch/custom-true-false-value.vue | 2 +-
.../demos/pc/app/switch/event-change-composition-api.vue | 2 +-
examples/sites/demos/pc/app/switch/event-change.vue | 2 +-
examples/sites/demos/pc/app/switch/webdoc/switch.cn.md | 2 +-
11 files changed, 20 insertions(+), 17 deletions(-)
diff --git a/examples/sites/demos/mobile-first/app/switch/webdoc/switch.cn.md b/examples/sites/demos/mobile-first/app/switch/webdoc/switch.cn.md
index c2715e255..f1fce1cc2 100644
--- a/examples/sites/demos/mobile-first/app/switch/webdoc/switch.cn.md
+++ b/examples/sites/demos/mobile-first/app/switch/webdoc/switch.cn.md
@@ -5,5 +5,5 @@ title: Switch 开关
# Switch 开关
-Switch 在两种状态间切换选择。
+在两种状态间切换选择。
diff --git a/examples/sites/demos/mobile-first/app/switch/webdoc/switch.en.md b/examples/sites/demos/mobile-first/app/switch/webdoc/switch.en.md
index c2715e255..f1fce1cc2 100644
--- a/examples/sites/demos/mobile-first/app/switch/webdoc/switch.en.md
+++ b/examples/sites/demos/mobile-first/app/switch/webdoc/switch.en.md
@@ -5,5 +5,5 @@ title: Switch 开关
# Switch 开关
-Switch 在两种状态间切换选择。
+在两种状态间切换选择。
diff --git a/examples/sites/demos/mobile/app/switch/webdoc/switch.cn.md b/examples/sites/demos/mobile/app/switch/webdoc/switch.cn.md
index a1587a230..e4a9314b8 100644
--- a/examples/sites/demos/mobile/app/switch/webdoc/switch.cn.md
+++ b/examples/sites/demos/mobile/app/switch/webdoc/switch.cn.md
@@ -1,12 +1,11 @@
---
-title: Switch 开关
+title: Switch 开关
---
-# Switch 开关
+# Switch 开关
-Switch 在两种状态间切换选择。
+在两种状态间切换选择。
-
diff --git a/examples/sites/demos/pc/app/switch/before-change-composition-api.vue b/examples/sites/demos/pc/app/switch/before-change-composition-api.vue
index 5d4b1012b..58dbee332 100644
--- a/examples/sites/demos/pc/app/switch/before-change-composition-api.vue
+++ b/examples/sites/demos/pc/app/switch/before-change-composition-api.vue
@@ -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)
}
diff --git a/examples/sites/demos/pc/app/switch/before-change.vue b/examples/sites/demos/pc/app/switch/before-change.vue
index 1e446b914..7cdfdf8a0 100644
--- a/examples/sites/demos/pc/app/switch/before-change.vue
+++ b/examples/sites/demos/pc/app/switch/before-change.vue
@@ -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)
}
}
diff --git a/examples/sites/demos/pc/app/switch/custom-true-false-value-composition-api.vue b/examples/sites/demos/pc/app/switch/custom-true-false-value-composition-api.vue
index 82e5d9a8b..fc3278886 100644
--- a/examples/sites/demos/pc/app/switch/custom-true-false-value-composition-api.vue
+++ b/examples/sites/demos/pc/app/switch/custom-true-false-value-composition-api.vue
@@ -1,7 +1,7 @@
- 当前值:{{ value }}
+ 当前值: {{ value }}
diff --git a/examples/sites/demos/pc/app/switch/custom-true-false-value.spec.ts b/examples/sites/demos/pc/app/switch/custom-true-false-value.spec.ts
index 8e781bd4c..07317780d 100644
--- a/examples/sites/demos/pc/app/switch/custom-true-false-value.spec.ts
+++ b/examples/sites/demos/pc/app/switch/custom-true-false-value.spec.ts
@@ -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')
})
diff --git a/examples/sites/demos/pc/app/switch/custom-true-false-value.vue b/examples/sites/demos/pc/app/switch/custom-true-false-value.vue
index 1d6f03a22..a622c5700 100644
--- a/examples/sites/demos/pc/app/switch/custom-true-false-value.vue
+++ b/examples/sites/demos/pc/app/switch/custom-true-false-value.vue
@@ -1,7 +1,7 @@
- 当前值:{{ value }}
+ 当前值: {{ value }}
diff --git a/examples/sites/demos/pc/app/switch/event-change-composition-api.vue b/examples/sites/demos/pc/app/switch/event-change-composition-api.vue
index aeb5892e4..a1e83ba40 100644
--- a/examples/sites/demos/pc/app/switch/event-change-composition-api.vue
+++ b/examples/sites/demos/pc/app/switch/event-change-composition-api.vue
@@ -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' })
}
diff --git a/examples/sites/demos/pc/app/switch/event-change.vue b/examples/sites/demos/pc/app/switch/event-change.vue
index 3c7b0f295..e5f4b3e52 100644
--- a/examples/sites/demos/pc/app/switch/event-change.vue
+++ b/examples/sites/demos/pc/app/switch/event-change.vue
@@ -11,7 +11,7 @@ export default {
},
methods: {
handleChange(val) {
- Modal.message({ message: `开关值:${val}` })
+ Modal.message({ message: `开关值:${val}`, status: 'info' })
}
}
}
diff --git a/examples/sites/demos/pc/app/switch/webdoc/switch.cn.md b/examples/sites/demos/pc/app/switch/webdoc/switch.cn.md
index ad35823c1..2dc4b543a 100644
--- a/examples/sites/demos/pc/app/switch/webdoc/switch.cn.md
+++ b/examples/sites/demos/pc/app/switch/webdoc/switch.cn.md
@@ -4,4 +4,4 @@ title: Switch 开关
# Switch 开关
-Switch 在两种状态间切换选择。
+在两种状态间切换选择。