From 329a1f884d65983e5315ab2c41dff26ff147aeab Mon Sep 17 00:00:00 2001 From: neverland Date: Thu, 13 Dec 2018 17:03:09 +0800 Subject: [PATCH] [improvement] Switch: optimize computed (#1079) --- packages/switch/index.ts | 7 ------- packages/switch/index.wxml | 2 +- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/packages/switch/index.ts b/packages/switch/index.ts index 552de7c0..8bf5b019 100644 --- a/packages/switch/index.ts +++ b/packages/switch/index.ts @@ -23,13 +23,6 @@ VantComponent({ } }, - computed: { - style() { - const backgroundColor = this.data.checked ? this.data.activeColor : this.data.inactiveColor; - return `font-size: ${this.data.size}; ${ backgroundColor ? `background-color: ${backgroundColor}` : '' }` - } - }, - created() { this.set({ value: this.data.checked }); }, diff --git a/packages/switch/index.wxml b/packages/switch/index.wxml index 1929fb01..e215473c 100644 --- a/packages/switch/index.wxml +++ b/packages/switch/index.wxml @@ -1,8 +1,8 @@