From 339df6c0e67b4a1b572ccb74f2b03638d1894902 Mon Sep 17 00:00:00 2001 From: neverland Date: Tue, 11 Dec 2018 15:51:57 +0800 Subject: [PATCH] [improvement] use wxs.bem instead of computed classNames (#1051) --- packages/checkbox/index.ts | 12 ------------ packages/checkbox/index.wxml | 4 +++- packages/col/index.ts | 10 ---------- packages/col/index.wxml | 4 +++- packages/collapse-item/index.ts | 16 +++------------- packages/collapse-item/index.wxml | 4 +++- packages/common/class-names.ts | 29 ----------------------------- packages/field/index.less | 8 ++++---- packages/field/index.ts | 12 ------------ packages/field/index.wxml | 10 ++++++---- packages/goods-action/index.ts | 9 --------- packages/goods-action/index.wxml | 4 +++- packages/mixins/basic.ts | 4 ---- packages/popup/index.ts | 10 ---------- packages/popup/index.wxml | 4 +++- packages/radio/index.ts | 11 ----------- packages/radio/index.wxml | 4 +++- packages/submit-bar/index.ts | 7 ------- packages/submit-bar/index.wxml | 4 +++- packages/switch/index.ts | 7 ------- packages/switch/index.wxml | 4 +++- packages/tabbar/index.ts | 10 ---------- packages/tabbar/index.wxml | 4 +++- packages/tag/index.ts | 11 ----------- packages/tag/index.wxml | 4 +++- packages/wxs/bem.wxs | 2 +- 26 files changed, 44 insertions(+), 164 deletions(-) delete mode 100644 packages/common/class-names.ts diff --git a/packages/checkbox/index.ts b/packages/checkbox/index.ts index 397a9097..defb21df 100644 --- a/packages/checkbox/index.ts +++ b/packages/checkbox/index.ts @@ -24,18 +24,6 @@ VantComponent({ }, computed: { - iconClass(): string { - const { disabled, value, shape } = this.data; - return this.classNames( - 'van-checkbox__icon', - `van-checkbox__icon--${shape}`, - { - 'van-checkbox__icon--disabled': disabled, - 'van-checkbox__icon--checked': value - } - ); - }, - iconStyle(): string { const { value, disabled, checkedColor } = this.data; if (checkedColor && value && !disabled) { diff --git a/packages/checkbox/index.wxml b/packages/checkbox/index.wxml index ab5637a9..da96d043 100644 --- a/packages/checkbox/index.wxml +++ b/packages/checkbox/index.wxml @@ -1,10 +1,12 @@ + + + diff --git a/packages/collapse-item/index.ts b/packages/collapse-item/index.ts index 85393c6c..af70c961 100644 --- a/packages/collapse-item/index.ts +++ b/packages/collapse-item/index.ts @@ -12,11 +12,11 @@ VantComponent({ }, props: { - name: [String, Number], + name: null, + title: null, + value: null, icon: String, label: String, - title: [String, Number], - value: [String, Number], disabled: Boolean, border: { type: Boolean, @@ -33,16 +33,6 @@ VantComponent({ expanded: false }, - computed: { - titleClass() { - const { disabled, expanded } = this.data; - return this.classNames('van-collapse-item__title', { - 'van-collapse-item__title--disabled': disabled, - 'van-collapse-item__title--expanded': expanded - }); - } - }, - methods: { updateExpanded() { if (!this.parent) { diff --git a/packages/collapse-item/index.wxml b/packages/collapse-item/index.wxml index 6bf5ff10..4f51da13 100644 --- a/packages/collapse-item/index.wxml +++ b/packages/collapse-item/index.wxml @@ -1,3 +1,5 @@ + + +