diff --git a/packages/address-edit/test/__snapshots__/index.spec.js.snap b/packages/address-edit/test/__snapshots__/index.spec.js.snap
index a2a322fad..654db7ce2 100644
--- a/packages/address-edit/test/__snapshots__/index.spec.js.snap
+++ b/packages/address-edit/test/__snapshots__/index.spec.js.snap
@@ -96,10 +96,8 @@ exports[`create a AddressEdit with props 1`] = `
设为默认收货地址
diff --git a/packages/checkbox/index.js b/packages/checkbox/index.js
index 994eb4c59..ad7ff179e 100644
--- a/packages/checkbox/index.js
+++ b/packages/checkbox/index.js
@@ -4,12 +4,7 @@ import CheckboxMixin from '../mixins/checkbox';
const [sfc, bem] = use('checkbox');
export default sfc({
- mixins: [
- CheckboxMixin({
- bem,
- parent: 'van-checkbox-group'
- })
- ],
+ mixins: [CheckboxMixin('van-checkbox-group', bem)],
computed: {
checked: {
diff --git a/packages/mixins/checkbox.js b/packages/mixins/checkbox.js
index e3cb4b9d7..94ea5dc23 100644
--- a/packages/mixins/checkbox.js
+++ b/packages/mixins/checkbox.js
@@ -4,7 +4,7 @@
import Icon from '../icon';
import findParent from './find-parent';
-export default ({ parent, bem }) => ({
+export default (parent, bem) => ({
mixins: [findParent],
props: {
diff --git a/packages/mixins/switch.js b/packages/mixins/switch.js
new file mode 100644
index 000000000..303279521
--- /dev/null
+++ b/packages/mixins/switch.js
@@ -0,0 +1,25 @@
+/**
+ * Common Switch Props
+ */
+
+export default {
+ props: {
+ value: null,
+ loading: Boolean,
+ disabled: Boolean,
+ activeColor: String,
+ inactiveColor: String,
+ activeValue: {
+ type: null,
+ default: true
+ },
+ inactiveValue: {
+ type: null,
+ default: false
+ },
+ size: {
+ type: String,
+ default: '30px'
+ }
+ }
+};
diff --git a/packages/radio/index.js b/packages/radio/index.js
index 8552690fc..f9705e710 100644
--- a/packages/radio/index.js
+++ b/packages/radio/index.js
@@ -4,12 +4,7 @@ import CheckboxMixin from '../mixins/checkbox';
const [sfc, bem] = use('radio');
export default sfc({
- mixins: [
- CheckboxMixin({
- bem,
- parent: 'van-radio-group'
- })
- ],
+ mixins: [CheckboxMixin('van-radio-group', bem)],
computed: {
currentValue: {
diff --git a/packages/switch-cell/index.js b/packages/switch-cell/index.js
new file mode 100644
index 000000000..770f6cb49
--- /dev/null
+++ b/packages/switch-cell/index.js
@@ -0,0 +1,38 @@
+import { use } from '../utils';
+import Cell from '../cell';
+import Switch from '../switch';
+import SwitchMixin from '../mixins/switch';
+
+const [sfc, bem] = use('switch-cell');
+
+export default sfc({
+ mixins: [SwitchMixin],
+
+ props: {
+ title: String,
+ border: Boolean,
+ size: {
+ type: String,
+ default: '24px'
+ }
+ },
+
+ watch: {
+ value() {
+ this.$emit('change', this.value);
+ }
+ },
+
+ render(h) {
+ return (
+
+ {
+ this.$emit('input', value);
+ }}
+ />
+ |
+ );
+ }
+});
diff --git a/packages/switch-cell/index.vue b/packages/switch-cell/index.vue
deleted file mode 100644
index 433d5e651..000000000
--- a/packages/switch-cell/index.vue
+++ /dev/null
@@ -1,54 +0,0 @@
-
-
-
- |
-
-
-
diff --git a/packages/switch-cell/test/__snapshots__/demo.spec.js.snap b/packages/switch-cell/test/__snapshots__/demo.spec.js.snap
index e312caf1a..ffa1b34de 100644
--- a/packages/switch-cell/test/__snapshots__/demo.spec.js.snap
+++ b/packages/switch-cell/test/__snapshots__/demo.spec.js.snap
@@ -7,10 +7,8 @@ exports[`renders demo correctly 1`] = `
标题
@@ -21,10 +19,8 @@ exports[`renders demo correctly 1`] = `
标题
@@ -35,7 +31,7 @@ exports[`renders demo correctly 1`] = `
标题
-
+
diff --git a/packages/switch/index.js b/packages/switch/index.js
index e6c033fda..07815f6dd 100644
--- a/packages/switch/index.js
+++ b/packages/switch/index.js
@@ -1,28 +1,11 @@
import { use } from '../utils';
import Loading from '../loading';
+import SwitchMixin from '../mixins/switch';
const [sfc, bem] = use('switch');
export default sfc({
- props: {
- value: null,
- loading: Boolean,
- disabled: Boolean,
- activeColor: String,
- inactiveColor: String,
- activeValue: {
- type: null,
- default: true
- },
- inactiveValue: {
- type: null,
- default: false
- },
- size: {
- type: String,
- default: '30px'
- }
- },
+ mixins: [SwitchMixin],
methods: {
onClick() {
diff --git a/packages/switch/test/__snapshots__/demo.spec.js.snap b/packages/switch/test/__snapshots__/demo.spec.js.snap
index 95434edef..a236fe2a7 100644
--- a/packages/switch/test/__snapshots__/demo.spec.js.snap
+++ b/packages/switch/test/__snapshots__/demo.spec.js.snap
@@ -4,16 +4,12 @@ exports[`renders demo correctly 1`] = `
@@ -25,23 +21,17 @@ exports[`renders demo correctly 1`] = `