From df4ae775c1e8bb125856105c3d039a60410c089b Mon Sep 17 00:00:00 2001 From: supergaojian <402853745@qq.com> Date: Thu, 9 May 2019 13:10:53 +0800 Subject: [PATCH] feat(check-list): support check-list icon slot BREAKING CHANGE: new props only support for new version v2.2.2 feat #383 --- components/check/README.en-US.md | 8 ++++ components/check/README.md | 8 ++++ components/check/demo/cases/demo4.vue | 4 +- components/check/demo/cases/demo5.vue | 43 +++++++++++++++++++ components/check/demo/index.vue | 3 +- components/check/index.vue | 18 +++----- components/check/list.vue | 14 +++--- components/check/mixin/index.js | 28 ++++++++++++ .../test/__snapshots__/demo.spec.js.snap | 18 +++----- 9 files changed, 111 insertions(+), 33 deletions(-) create mode 100644 components/check/demo/cases/demo5.vue create mode 100644 components/check/mixin/index.js diff --git a/components/check/README.en-US.md b/components/check/README.en-US.md index 7fd6aeb76..4e030bdf2 100644 --- a/components/check/README.en-US.md +++ b/components/check/README.en-US.md @@ -31,6 +31,8 @@ Vue.component(CheckList.name, CheckList) |icon|icon name of checked options|String|`checked`|-| |icon-inverse|icon name of unchecked options|String|`checke`|-| |icon-disabled|icon name of disabled options|String|`check-disabled`|-| +|icon-svg|use svg icon|Boolean|`false`|-| +|size|size of icon|String|`md`|-| --- #### CheckBox Props @@ -77,6 +79,12 @@ Check multiple checks. Combine with `Check` or `CheckBox`. |----|-----|------|------|------| |v-model|selected names|Array|-|-| |options|data otpions|Array<{text, value, disabled, ...}>|`[]`|-| +|icon|icon of selected option|String|`checked`|-| +|icon-inverse|icon of unselected options|String|`check`|-| +|icon-disabled|icon of disabled options|String|`check-disabled`|-| +|icon-size|the size of icon|String|`md`|-| +|icon-svg|use svg icon|Boolean|`false`|-| +|icon-position|the position of icon|String|`right`|`left`, `right`| |is-slot-scope|if it is mandatory to use `slot-scope`|Boolean|-|it depends on exact cases to determine whether to use it or not, and avoids adding `if/else` to component| #### CheckList Slots diff --git a/components/check/README.md b/components/check/README.md index 62c5852af..f29bff618 100644 --- a/components/check/README.md +++ b/components/check/README.md @@ -29,6 +29,8 @@ Vue.component(CheckList.name, CheckList) |icon|选中项图标名称|String|`checked`|-| |icon-inverse|未选中项图标名称|String|`checke`|-| |icon-disabled|禁用项选择图标名称|String|`check-disabled`|-| +|icon-svg|使用svg图标|Boolean|`false`|-| +|size|图标大小|String|`md`|-| --- #### CheckBox Props @@ -75,6 +77,12 @@ Vue.component(CheckList.name, CheckList) |----|-----|------|------|------| |v-model|选中项的`value`|Array|-|-| |options|选项数据源|Array<{text, value, disabled, ...}>|`[]`|`disabled`为选项是否禁用| +|icon|选中项的图标|String|`checked`|-| +|icon-inverse|非选中项的图标|String|`check`|-| +|icon-disabled|禁用项的图标|String|`check-disabled`|-| +|icon-size|图标大小|String|`md`|-| +|icon-svg|使用svg图标|Boolean|`false`|-| +|icon-position|图标位置|String|`right`|`left`, `right`| |is-slot-scope|是否强制使用或不使用`slot-scope`|Boolean|-|某些情况下需要根据业务逻辑动态确定是否使用,可避免直接组件上加`if/else`| #### CheckList Slots diff --git a/components/check/demo/cases/demo4.vue b/components/check/demo/cases/demo4.vue index e2a072022..d3ba6119d 100644 --- a/components/check/demo/cases/demo4.vue +++ b/components/check/demo/cases/demo4.vue @@ -2,8 +2,10 @@