diff --git a/CHANGELOG.md b/CHANGELOG.md index ead19a7d9..e59dd56fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,26 @@ toc: false spline: explain --- +## 🌈 0.15.0 `2023-03-20` +### ❗ BREAKING CHANGES +- `Stepper`: 属性 theme 的 gray 主题更名为 filled,并新增 outline 主题 @anlyyao ([#518](https://github.com/Tencent/tdesign-mobile-vue/pull/518)) +- `Radio`: 属性 align 更名为 placement @LeeJim ([#517](https://github.com/Tencent/tdesign-mobile-vue/pull/517)) +- `Radio`: 属性 icon 的枚举值变更、DOM 变更 @LeeJim ([#517](https://github.com/Tencent/tdesign-mobile-vue/pull/517)) +- `Switch`: 废弃 colors 属性,改用 CSS Variables @LeeJim ([#520](https://github.com/Tencent/tdesign-mobile-vue/pull/520)) +- `Switch`: 属性 label 的类型从 string 变为 array @LeeJim ([#520](https://github.com/Tencent/tdesign-mobile-vue/pull/520)) +- `Switch`: 优化 DOM @LeeJim ([#520](https://github.com/Tencent/tdesign-mobile-vue/pull/520)) + +### 🚀 Features +- `Tag`: 支持 css variable @anlyyao ([#507](https://github.com/Tencent/tdesign-mobile-vue/pull/507)) +- `Stepper`: 新增 size 属性 @anlyyao ([#518](https://github.com/Tencent/tdesign-mobile-vue/pull/518)) +- `Radio`: 新增支持 allowUncheck、block、maxContentRow、maxLabelRow 属性 @LeeJim ([#517](https://github.com/Tencent/tdesign-mobile-vue/pull/517)) +- `RadioGroup`: 新增支持 allowUncheck、borderless、keys、placement 属性 @LeeJim ([#517](https://github.com/Tencent/tdesign-mobile-vue/pull/517)) +- `Swtich`: 新增 icon、loading、size 属性 @LeeJim ([#520](https://github.com/Tencent/tdesign-mobile-vue/pull/520)) +### 🐞 Bug Fixes +- `Loading`: 修复部分浏览器下 loading 晃动问题 @anlyyao ([#505](https://github.com/Tencent/tdesign-mobile-vue/pull/505)) +- `Stepper`: 修复 min/max 存在时,输入受限问题 @anlyyao ([#518](https://github.com/Tencent/tdesign-mobile-vue/pull/518)) + + ## 🌈 0.14.1 `2022-11-14` ### 🚧 Others - `Badge`: 提升测试覆盖率 @anlyyao ([#479](https://github.com/Tencent/tdesign-mobile-vue/pull/479)) diff --git a/package.json b/package.json index 6df964c20..e0a58ff18 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "tdesign-mobile-vue", "purename": "tdesign", - "version": "0.14.1", + "version": "0.15.0", "description": "tdesign-mobile-vue", "author": "TDesign Group", "homepage": "https://tdesign.tencent.com/mobile-vue/", @@ -20,9 +20,9 @@ "prebuild": "rimraf dist/* lib/* es/* esm/* typings/*", "build": "cross-env NODE_ENV=production rollup -c scripts/rollup.config.js && npm run build:tsc", "build:tsc": "concurrently \"npm:build:tsc-*\"", - "build:tsc-es": "vue-tsc --declaration --emitDeclarationOnly --outDir es/ -p tsconfig.build.json", - "build:tsc-esm": "vue-tsc --declaration --emitDeclarationOnly --outDir esm/ -p tsconfig.build.json", - "build:tsc-lib": "vue-tsc --declaration --emitDeclarationOnly --outDir lib/ -p tsconfig.build.json", + "build:tsc-es": "vue-tsc --declaration --emitDeclarationOnly --outDir es/", + "build:tsc-esm": "vue-tsc --declaration --emitDeclarationOnly --outDir esm/", + "build:tsc-lib": "vue-tsc --declaration --emitDeclarationOnly --outDir lib/", "site": "cd site && vite build", "site:intranet": "cd site && vite build --mode intranet", "site:preview": "cd site && vite build --mode preview", @@ -109,15 +109,15 @@ "@rollup/plugin-url": "^6.0.0", "@soerenmartius/vue3-clipboard": "^0.1.1", "@types/jest": "^28.1.6", - "@types/prismjs": "^1.16.2", "@types/node": "18.8.0", + "@types/prismjs": "^1.16.2", "@typescript-eslint/eslint-plugin": "^5.5.0", "@typescript-eslint/parser": "~5.34.0", "@vitejs/plugin-vue": "^1.2.3", "@vitejs/plugin-vue-jsx": "^1.3.3", "@vitest/ui": "^0.16.0", "@vue/eslint-config-typescript": "^9.1.0", - "@vue/runtime-core": "3.2.41", + "@vue/runtime-core": "^3.2.41", "@vue/test-utils": "^2.0.0-rc.17", "autoprefixer": "^10.2.4", "axios": "^0.21.0", @@ -161,13 +161,13 @@ "rollup-pluginutils": "^2.8.2", "tdesign-icons-view": "^0.1.0", "tdesign-publish-cli": "^0.0.10", - "tdesign-site-components": "0.11.15", + "tdesign-site-components": "^0.11.19", "tslib": "^2.3.1", "typescript": "~4.7.2", "vite": "^2.9.14", "vite-plugin-tdoc": "^2.0.1", "vitest": "^0.16.0", - "vue": "^3.2.33", + "vue": "^3.2.47", "vue-eslint-parser": "^8.0.1", "vue-router": "4.0.11", "vue-tsc": "^0.40.0" diff --git a/site/mobile/main.ts b/site/mobile/main.ts index faa003f44..b3389ff79 100644 --- a/site/mobile/main.ts +++ b/site/mobile/main.ts @@ -6,7 +6,6 @@ import router from './router'; import TDesign from '@/index'; import '../../src/_common/style/mobile/_reset.less'; -import '../../src/_common/style/mobile/index.less'; import '../styles/mobile/index.less'; createApp(app) diff --git a/site/web/main.ts b/site/web/main.ts index cfde4caef..0dd67826c 100644 --- a/site/web/main.ts +++ b/site/web/main.ts @@ -5,8 +5,7 @@ import TDesign from '@/index'; import Stackblitz from './stackblitz/index.vue'; // import tdesign style -import '@common/style/mobile/_reset.less'; -import '@common/style/mobile/index.less'; +import 'tdesign-mobile-vue/style/index.js'; // import site webcomponents import 'tdesign-site-components'; diff --git a/site/web/plugin-tdoc/transforms.js b/site/web/plugin-tdoc/transforms.js index 1e835d801..b6a605334 100644 --- a/site/web/plugin-tdoc/transforms.js +++ b/site/web/plugin-tdoc/transforms.js @@ -14,7 +14,7 @@ export default { // 统一换成 common 文档内容 if (name && source.includes(':: BASE_DOC ::')) { - const docPath = path.resolve(__dirname, `../../../src/_common/docs/mobile/api/${name}.md`); + const docPath = path.resolve(__dirname, `../../../src/_common/docs/mobile/api_v2/${name}.md`); if (fs.existsSync(docPath)) { const baseDoc = fs.readFileSync(docPath, 'utf-8'); source = source.replace(':: BASE_DOC ::', baseDoc); diff --git a/src/_common b/src/_common index 0f49a8975..0a709515d 160000 --- a/src/_common +++ b/src/_common @@ -1 +1 @@ -Subproject commit 0f49a89751a960aefce24fc1b8e4f50f49613397 +Subproject commit 0a709515dd1bdebc42e18f4224c6b99395b01a55 diff --git a/src/action-sheet/action-sheet.vue b/src/action-sheet/action-sheet.vue index 9d11256f2..85d9e4cb5 100644 --- a/src/action-sheet/action-sheet.vue +++ b/src/action-sheet/action-sheet.vue @@ -23,7 +23,7 @@ - - diff --git a/src/back-top/demos/mobile.vue b/src/back-top/demos/mobile.vue index b293961d8..d81f571d7 100644 --- a/src/back-top/demos/mobile.vue +++ b/src/back-top/demos/mobile.vue @@ -49,7 +49,7 @@ const rowCols = [ ]; window.document.addEventListener('scroll', function (e: Event) { - const { scrollTop } = e.currentTarget?.scrollingElement || {}; + const { scrollTop = 0 } = (e.currentTarget as Document)?.scrollingElement || {}; if (scrollTop <= 300) { style.value = { display: 'none' }; } else { diff --git a/src/back-top/demos/target.vue b/src/back-top/demos/target.vue deleted file mode 100644 index 0a51234d4..000000000 --- a/src/back-top/demos/target.vue +++ /dev/null @@ -1,27 +0,0 @@ - - - - - diff --git a/src/back-top/demos/theme.vue b/src/back-top/demos/theme.vue deleted file mode 100644 index 2ff10be8f..000000000 --- a/src/back-top/demos/theme.vue +++ /dev/null @@ -1,20 +0,0 @@ - - - - - diff --git a/src/button/button.vue b/src/button/button.vue index e76f1ca61..8af780218 100644 --- a/src/button/button.vue +++ b/src/button/button.vue @@ -8,7 +8,7 @@ + + diff --git a/src/radio/demos/custom.vue b/src/radio/demos/custom.vue new file mode 100644 index 000000000..e162b45b4 --- /dev/null +++ b/src/radio/demos/custom.vue @@ -0,0 +1,86 @@ + + + + diff --git a/src/radio/demos/group.vue b/src/radio/demos/group.vue deleted file mode 100644 index ba6935755..000000000 --- a/src/radio/demos/group.vue +++ /dev/null @@ -1,42 +0,0 @@ - - - diff --git a/src/radio/demos/horizontal.vue b/src/radio/demos/horizontal.vue new file mode 100644 index 000000000..e1a1ee8cd --- /dev/null +++ b/src/radio/demos/horizontal.vue @@ -0,0 +1,29 @@ + + + + + diff --git a/src/radio/demos/icon.vue b/src/radio/demos/icon.vue index 3c0658de0..43833663a 100644 --- a/src/radio/demos/icon.vue +++ b/src/radio/demos/icon.vue @@ -1,11 +1,8 @@ + + diff --git a/src/radio/demos/mobile.vue b/src/radio/demos/mobile.vue index 347956551..0355eaac1 100644 --- a/src/radio/demos/mobile.vue +++ b/src/radio/demos/mobile.vue @@ -2,42 +2,42 @@

Radio 单选框

用于在预设的一组选项中执行单项选择,并呈现选择结果。

- + - - + + - - + + - - + + - - + + - - + + - - + +
diff --git a/src/radio/demos/placement.vue b/src/radio/demos/placement.vue new file mode 100644 index 000000000..1620725b1 --- /dev/null +++ b/src/radio/demos/placement.vue @@ -0,0 +1,12 @@ + + + + + diff --git a/src/radio/demos/right.vue b/src/radio/demos/right.vue deleted file mode 100644 index 52f60bb16..000000000 --- a/src/radio/demos/right.vue +++ /dev/null @@ -1,20 +0,0 @@ - - - diff --git a/src/radio/demos/rightStrovkeLine.vue b/src/radio/demos/rightStrovkeLine.vue deleted file mode 100644 index e9eff51e0..000000000 --- a/src/radio/demos/rightStrovkeLine.vue +++ /dev/null @@ -1,37 +0,0 @@ - - - diff --git a/src/radio/demos/size.vue b/src/radio/demos/size.vue deleted file mode 100644 index bba032374..000000000 --- a/src/radio/demos/size.vue +++ /dev/null @@ -1,37 +0,0 @@ - - - diff --git a/src/radio/demos/status.vue b/src/radio/demos/status.vue index 5dc95056f..f418fd855 100644 --- a/src/radio/demos/status.vue +++ b/src/radio/demos/status.vue @@ -1,36 +1,20 @@ + + diff --git a/src/stepper/demos/min-max.vue b/src/stepper/demos/min-max.vue new file mode 100644 index 000000000..5d8847f8f --- /dev/null +++ b/src/stepper/demos/min-max.vue @@ -0,0 +1,41 @@ + + + + + diff --git a/src/stepper/demos/mobile.vue b/src/stepper/demos/mobile.vue index db454416f..f52ae5dee 100644 --- a/src/stepper/demos/mobile.vue +++ b/src/stepper/demos/mobile.vue @@ -1,27 +1,29 @@ diff --git a/src/stepper/demos/pure-stepper.vue b/src/stepper/demos/pure-stepper.vue deleted file mode 100644 index 8e5b948b4..000000000 --- a/src/stepper/demos/pure-stepper.vue +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/src/stepper/demos/size.vue b/src/stepper/demos/size.vue new file mode 100644 index 000000000..3481b3a94 --- /dev/null +++ b/src/stepper/demos/size.vue @@ -0,0 +1,27 @@ + + + + + diff --git a/src/stepper/demos/status.vue b/src/stepper/demos/status.vue index 4356aed5e..3db3b5dd0 100644 --- a/src/stepper/demos/status.vue +++ b/src/stepper/demos/status.vue @@ -1,43 +1,12 @@ - + diff --git a/src/stepper/demos/theme.vue b/src/stepper/demos/theme.vue new file mode 100644 index 000000000..156f32e2e --- /dev/null +++ b/src/stepper/demos/theme.vue @@ -0,0 +1,17 @@ + + + diff --git a/src/stepper/demos/unit-stepper.vue b/src/stepper/demos/unit-stepper.vue deleted file mode 100644 index 45ac68dca..000000000 --- a/src/stepper/demos/unit-stepper.vue +++ /dev/null @@ -1,32 +0,0 @@ - - - diff --git a/src/stepper/props.ts b/src/stepper/props.ts index a3ac80139..3af219423 100644 --- a/src/stepper/props.ts +++ b/src/stepper/props.ts @@ -8,10 +8,10 @@ import { TdStepperProps } from './type'; import { PropType } from 'vue'; export default { - /** 禁用全部操作 */ - disabled: Boolean, /** 禁用输入框 */ disableInput: Boolean, + /** 禁用全部操作 */ + disabled: Boolean, /** 输入框宽度 */ inputWidth: { type: Number, @@ -26,6 +26,15 @@ export default { type: Number, default: 0, }, + /** 组件尺寸 */ + size: { + type: String as PropType, + default: 'medium' as TdStepperProps['size'], + validator(val: TdStepperProps['size']): boolean { + if (!val) return true; + return ['small', 'medium', 'large'].includes(val); + }, + }, /** 步长 */ step: { type: Number, @@ -36,7 +45,8 @@ export default { type: String as PropType, default: 'normal' as TdStepperProps['theme'], validator(val: TdStepperProps['theme']): boolean { - return ['normal', 'grey'].includes(val!); + if (!val) return true; + return ['normal', 'filled', 'outline'].includes(val); }, }, /** 值 */ diff --git a/src/stepper/stepper.en-US.md b/src/stepper/stepper.en-US.md new file mode 100644 index 000000000..408c6c2a1 --- /dev/null +++ b/src/stepper/stepper.en-US.md @@ -0,0 +1,28 @@ +:: BASE_DOC :: + +## API +### Stepper Props + +name | type | default | description | required +-- | -- | -- | -- | -- +disableInput | Boolean | false | \- | N +disabled | Boolean | false | \- | N +inputWidth | Number | - | \- | N +max | Number | 100 | \- | N +min | Number | 0 | \- | N +size | String | medium | options:small/medium/large。Typescript:`SizeEnum`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N +step | Number | 1 | \- | N +theme | String | normal | stylish。options:normal/filled/outline | N +value | String / Number | 0 | `v-model` and `v-model:value` is supported | N +defaultValue | String / Number | 0 | uncontrolled property | N +onBlur | Function | | Typescript:`(value: string \| number) => void`
| N +onChange | Function | | Typescript:`(value: string \| number) => void`
| N +onOverlimit | Function | | Typescript:`(type: 'minus' \| 'plus') => void`
| N + +### Stepper Events + +name | params | description +-- | -- | -- +blur | `(value: string \| number)` | \- +change | `(value: string \| number)` | \- +overlimit | `(type: 'minus' \| 'plus')` | \- diff --git a/src/stepper/stepper.md b/src/stepper/stepper.md index 5bbedcb9b..4184b724b 100644 --- a/src/stepper/stepper.md +++ b/src/stepper/stepper.md @@ -5,23 +5,24 @@ 名称 | 类型 | 默认值 | 说明 | 必传 -- | -- | -- | -- | -- -disabled | Boolean | false | 禁用全部操作 | N disableInput | Boolean | false | 禁用输入框 | N +disabled | Boolean | false | 禁用全部操作 | N inputWidth | Number | - | 输入框宽度 | N max | Number | 100 | 最大值 | N min | Number | 0 | 最小值 | N +size | String | medium | 组件尺寸。可选项:small/medium/large。TS 类型:`SizeEnum`。[通用类型定义](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N step | Number | 1 | 步长 | N -theme | String | normal | 组件风格。可选项:normal/grey | N +theme | String | normal | 组件风格。可选项:normal/filled/outline | N value | String / Number | 0 | 值。支持语法糖 `v-model` 或 `v-model:value` | N defaultValue | String / Number | 0 | 值。非受控属性 | N -onBlur | Function | | TS 类型:`(value: string | number) => void`
输入框失去焦点时触发 | N -onChange | Function | | TS 类型:`(value: string | number) => void`
数值发生变更时触发 | N -onOverlimit | Function | | TS 类型:`(type: 'minus' | 'plus') => void`
数值超出限制时触发 | N +onBlur | Function | | TS 类型:`(value: string \| number) => void`
输入框失去焦点时触发 | N +onChange | Function | | TS 类型:`(value: string \| number) => void`
数值发生变更时触发 | N +onOverlimit | Function | | TS 类型:`(type: 'minus' \| 'plus') => void`
数值超出限制时触发 | N ### Stepper Events 名称 | 参数 | 描述 -- | -- | -- -blur | `(value: string | number)` | 输入框失去焦点时触发 -change | `(value: string | number)` | 数值发生变更时触发 -overlimit | `(type: 'minus' | 'plus')` | 数值超出限制时触发 +blur | `(value: string \| number)` | 输入框失去焦点时触发 +change | `(value: string \| number)` | 数值发生变更时触发 +overlimit | `(type: 'minus' \| 'plus')` | 数值超出限制时触发 diff --git a/src/stepper/stepper.vue b/src/stepper/stepper.vue index 418943f99..5e809fd95 100644 --- a/src/stepper/stepper.vue +++ b/src/stepper/stepper.vue @@ -1,36 +1,57 @@ diff --git a/src/swipe-cell/demos/left-two-menu.vue b/src/swipe-cell/demos/left-two-menu.vue index 3e420ef7d..4c3a55b08 100644 --- a/src/swipe-cell/demos/left-two-menu.vue +++ b/src/swipe-cell/demos/left-two-menu.vue @@ -1,11 +1,11 @@ diff --git a/src/switch/demos/size.vue b/src/switch/demos/size.vue new file mode 100644 index 000000000..7800fd348 --- /dev/null +++ b/src/switch/demos/size.vue @@ -0,0 +1,23 @@ + + + diff --git a/src/switch/demos/status.vue b/src/switch/demos/status.vue new file mode 100644 index 000000000..596e50d66 --- /dev/null +++ b/src/switch/demos/status.vue @@ -0,0 +1,40 @@ + + + diff --git a/src/switch/props.ts b/src/switch/props.ts index 1884439e7..c88f8b1d2 100644 --- a/src/switch/props.ts +++ b/src/switch/props.ts @@ -8,20 +8,36 @@ import { TdSwitchProps } from './type'; import { PropType } from 'vue'; export default { - /** 自定义颜色,[打开时的颜色,关闭时的颜色]。组件默认颜色为 ['#0052d9', 'rgba(0, 0, 0, .26']。示例:[blue, gray] */ + /** 已废弃。已废弃。自定义颜色,[打开时的颜色,关闭时的颜色]。组件默认颜色为 ['#0052d9', 'rgba(0, 0, 0, .26']。示例:[blue, gray] */ colors: { type: Array as PropType, }, - /** 开关内容,[打开时的值,关闭时的值]。默认为 [true, false]。示例:[1, 0] */ + /** 用于自定义开关的值,[打开时的值,关闭时的值]。默认为 [true, false]。示例:[1, 0]、['open', 'close'] */ customValue: { type: Array as PropType, }, - /** 是否禁用组件 */ + /** 是否禁用组件,默认为 false */ disabled: Boolean, - /** 开关的标签 */ + /** 开关的图标;[打开时的图标,关闭时的图标] */ + icon: { + type: Array as PropType, + default: (): TdSwitchProps['icon'] => [], + }, + /** 开关的标签;[打开时的标签,关闭时的标签] */ label: { - type: String, - default: '', + type: Array as PropType, + default: (): TdSwitchProps['label'] => [], + }, + /** 是否处于加载中状态 */ + loading: Boolean, + /** 开关尺寸 */ + size: { + type: String as PropType, + default: 'medium' as TdSwitchProps['size'], + validator(val: TdSwitchProps['size']): boolean { + if (!val) return true; + return ['small', 'medium', 'large'].includes(val); + }, }, /** 开关值 */ value: { @@ -35,7 +51,6 @@ export default { /** 开关值,非受控属性 */ defaultValue: { type: [String, Number, Boolean] as PropType, - default: undefined, }, /** 数据发生变化时触发 */ onChange: Function as PropType, diff --git a/src/switch/style/index.js b/src/switch/style/index.js index 819f6e613..84f6dd097 100644 --- a/src/switch/style/index.js +++ b/src/switch/style/index.js @@ -1 +1 @@ -import '../../_common/style/mobile/components/switch/_index.less'; +import '../../_common/style/mobile/components/switch/v2/_index.less'; diff --git a/src/switch/switch.en-US.md b/src/switch/switch.en-US.md new file mode 100644 index 000000000..8a22fcb86 --- /dev/null +++ b/src/switch/switch.en-US.md @@ -0,0 +1,23 @@ +:: BASE_DOC :: + +## API +### Switch Props + +name | type | default | description | required +-- | -- | -- | -- | -- +colors | Array | - | `deprecated`。Typescript:`string[]` | N +customValue | Array | - | Typescript:`Array` | N +disabled | Boolean | - | \- | N +icon | Array | [] | Typescript:`TNode[]`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N +label | Array | [] | Typescript:`string[]` | N +loading | Boolean | false | \- | N +size | String | medium | options:small/medium/large | N +value | String / Number / Boolean | - | `v-model` and `v-model:value` is supported。Typescript:`T` `type SwitchValue = string \| number \| boolean`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/switch/type.ts) | N +defaultValue | String / Number / Boolean | - | uncontrolled property。Typescript:`T` `type SwitchValue = string \| number \| boolean`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/switch/type.ts) | N +onChange | Function | | Typescript:`(value: T) => void`
| N + +### Switch Events + +name | params | description +-- | -- | -- +change | `(value: T)` | \- diff --git a/src/switch/switch.md b/src/switch/switch.md index 31de635f1..1acd903ae 100644 --- a/src/switch/switch.md +++ b/src/switch/switch.md @@ -5,16 +5,19 @@ 名称 | 类型 | 默认值 | 说明 | 必传 -- | -- | -- | -- | -- -colors | Array | - | 自定义颜色,[打开时的颜色,关闭时的颜色]。组件默认颜色为 ['#0052d9', 'rgba(0, 0, 0, .26']。示例:[blue, gray]。TS 类型:`string[]` | N -customValue | Array | - | 开关内容,[打开时的值,关闭时的值]。默认为 [true, false]。示例:[1, 0]。TS 类型:`Array` | N -disabled | Boolean | false | 是否禁用组件 | N -label | String | '' | 开关的标签 | N -value | String / Number / Boolean | undefined | 开关值。支持语法糖 `v-model` 或 `v-model:value`。TS 类型:`SwitchValue` `type SwitchValue = string | number | boolean`。[详细类型定义](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/switch/type.ts) | N -defaultValue | String / Number / Boolean | undefined | 开关值。非受控属性。TS 类型:`SwitchValue` `type SwitchValue = string | number | boolean`。[详细类型定义](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/switch/type.ts) | N -onChange | Function | | TS 类型:`(value: SwitchValue) => void`
数据发生变化时触发 | N +colors | Array | - | 已废弃。已废弃。自定义颜色,[打开时的颜色,关闭时的颜色]。组件默认颜色为 ['#0052d9', 'rgba(0, 0, 0, .26']。示例:[blue, gray]。TS 类型:`string[]` | N +customValue | Array | - | 用于自定义开关的值,[打开时的值,关闭时的值]。默认为 [true, false]。示例:[1, 0]、['open', 'close']。TS 类型:`Array` | N +disabled | Boolean | - | 是否禁用组件,默认为 false | N +icon | Array | [] | 开关的图标;[打开时的图标,关闭时的图标]。TS 类型:`TNode[]`。[通用类型定义](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N +label | Array | [] | 开关的标签;[打开时的标签,关闭时的标签]。TS 类型:`string[]` | N +loading | Boolean | false | 是否处于加载中状态 | N +size | String | medium | 开关尺寸。可选项:small/medium/large | N +value | String / Number / Boolean | - | 开关值。支持语法糖 `v-model` 或 `v-model:value`。TS 类型:`T` `type SwitchValue = string \| number \| boolean`。[详细类型定义](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/switch/type.ts) | N +defaultValue | String / Number / Boolean | - | 开关值。非受控属性。TS 类型:`T` `type SwitchValue = string \| number \| boolean`。[详细类型定义](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/switch/type.ts) | N +onChange | Function | | TS 类型:`(value: T) => void`
数据发生变化时触发 | N ### Switch Events 名称 | 参数 | 描述 -- | -- | -- -change | `(value: SwitchValue)` | 数据发生变化时触发 +change | `(value: T)` | 数据发生变化时触发 diff --git a/src/switch/switch.vue b/src/switch/switch.vue index 8a3e8f353..eefc194f5 100644 --- a/src/switch/switch.vue +++ b/src/switch/switch.vue @@ -1,18 +1,22 @@ diff --git a/src/toast/demos/position.vue b/src/toast/demos/position.vue index 46f8712e6..3bfb8d746 100644 --- a/src/toast/demos/position.vue +++ b/src/toast/demos/position.vue @@ -14,8 +14,8 @@