From 20928347e749eceec95156f5fe9fa64a32d48c2f Mon Sep 17 00:00:00 2001 From: neverland Date: Tue, 11 Dec 2018 14:57:29 +0800 Subject: [PATCH] [improvement] Button: use wxs to optimize performance (#1049) --- example/pages/button/index.wxml | 1 - packages/button/index.ts | 15 ------------- packages/button/index.wxml | 4 +++- packages/icon/index.wxml | 4 ++-- packages/wxs/array.wxs | 5 +++++ packages/wxs/bem.wxs | 34 ++++++++++++++++++++++++++++++ packages/wxs/object.wxs | 13 ++++++++++++ packages/{common => wxs}/utils.wxs | 3 +++ 8 files changed, 60 insertions(+), 19 deletions(-) create mode 100644 packages/wxs/array.wxs create mode 100644 packages/wxs/bem.wxs create mode 100644 packages/wxs/object.wxs rename packages/{common => wxs}/utils.wxs (66%) diff --git a/example/pages/button/index.wxml b/example/pages/button/index.wxml index 495cf2e7..c91445c1 100644 --- a/example/pages/button/index.wxml +++ b/example/pages/button/index.wxml @@ -34,5 +34,4 @@ 小型按钮 迷你按钮 - diff --git a/packages/button/index.ts b/packages/button/index.ts index ccc246e9..94b03143 100644 --- a/packages/button/index.ts +++ b/packages/button/index.ts @@ -24,21 +24,6 @@ VantComponent({ } }, - computed: { - classes(): string { - const { type, size, block, plain, round, square, loading, disabled } = this.data; - return this.classNames('van-button', `van-button--${type}`, `van-button--${size}`, { - 'van-button--block': block, - 'van-button--round': round, - 'van-button--plain': plain, - 'van-button--square': square, - 'van-button--loading': loading, - 'van-button--disabled': disabled, - 'van-button--unclickable': disabled || loading - }); - } - }, - methods: { onClick() { if (!this.data.disabled && !this.data.loading) { diff --git a/packages/button/index.wxml b/packages/button/index.wxml index 3480f938..63817067 100644 --- a/packages/button/index.wxml +++ b/packages/button/index.wxml @@ -1,7 +1,9 @@ + +