From 68c02ae766369a9a95858fde9abb275f136b77e6 Mon Sep 17 00:00:00 2001 From: Guillaume Rouxel Date: Mon, 24 Oct 2016 22:36:00 +0200 Subject: [PATCH 1/3] add 'type' props to switch button --- docs/src/pages/components/Switch.vue | 43 +++++++++++++++++++++++++++- src/components/mdSwitch/mdSwitch.vue | 5 ++-- 2 files changed, 45 insertions(+), 3 deletions(-) diff --git a/docs/src/pages/components/Switch.vue b/docs/src/pages/components/Switch.vue index 289775e..b8478e4 100644 --- a/docs/src/pages/components/Switch.vue +++ b/docs/src/pages/components/Switch.vue @@ -36,6 +36,16 @@ Light Blue Primary Color Disabled + + +
+ Submit (default) +
+ +
+ Button +
+
@@ -67,6 +77,28 @@ </div> + + + +<form @click.stop.prevent="submit"> + <md-switch v-model="checked8" id="my-test8" name="my-test8">Submit (default)</md-switch> +</form> + +<div> + <md-switch type="button" v-model="checked9" id="my-test9" name="my-test9" class="md-primary">Button</md-switch> +</div> + + + +export default { + methods: { + submit(e) { + alert('Default switch submits form'); + } + } +}; + +
@@ -86,8 +118,17 @@ checked4: true, checked5: true, checked6: true, - checked7: true + checked7: true, + checked8: true, + checked9: true, + checked10: true }; + }, + + methods: { + submit(e) { + alert('Default switch submits form'); + } } }; diff --git a/src/components/mdSwitch/mdSwitch.vue b/src/components/mdSwitch/mdSwitch.vue index e2188a3..d3c6a46 100644 --- a/src/components/mdSwitch/mdSwitch.vue +++ b/src/components/mdSwitch/mdSwitch.vue @@ -3,7 +3,7 @@
- +
@@ -24,7 +24,8 @@ name: String, value: Boolean, id: String, - disabled: Boolean + disabled: Boolean, + type: String }, data() { return { From 25d7d6aea366669c7199f583872f01efb3bbb7a6 Mon Sep 17 00:00:00 2001 From: Guillaume Rouxel Date: Tue, 25 Oct 2016 11:47:21 +0200 Subject: [PATCH 2/3] updated docs --- docs/src/pages/components/Switch.vue | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/src/pages/components/Switch.vue b/docs/src/pages/components/Switch.vue index b8478e4..22bfe83 100644 --- a/docs/src/pages/components/Switch.vue +++ b/docs/src/pages/components/Switch.vue @@ -38,12 +38,12 @@ -
- Submit (default) -
+ Button (default)
- Button +
+ Submit +
@@ -80,20 +80,20 @@ -<form @click.stop.prevent="submit"> - <md-switch v-model="checked8" id="my-test8" name="my-test8">Submit (default)</md-switch> -</form> - <div> - <md-switch type="button" v-model="checked9" id="my-test9" name="my-test9" class="md-primary">Button</md-switch> + <md-switch v-model="checked8" id="my-test8" name="my-test8" class="md-primary">Button (default)</md-switch> </div> + +<form @click.stop.prevent="submit"> + <md-switch type="submit" v-model="checked9" id="my-test9" name="my-test9">Submit</md-switch> +</form> export default { methods: { submit(e) { - alert('Default switch submits form'); + alert('This switch submits the form'); } } }; @@ -126,8 +126,8 @@ export default { }, methods: { - submit(e) { - alert('Default switch submits form'); + submit() { + alert('This switch submits the form'); } } }; From 2c171450af3a796a94277e5cf3136bf79c3f941c Mon Sep 17 00:00:00 2001 From: Guillaume Rouxel Date: Tue, 25 Oct 2016 11:48:22 +0200 Subject: [PATCH 3/3] default 'type' value is now 'button' --- src/components/mdSwitch/mdSwitch.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/mdSwitch/mdSwitch.vue b/src/components/mdSwitch/mdSwitch.vue index d3c6a46..549ef50 100644 --- a/src/components/mdSwitch/mdSwitch.vue +++ b/src/components/mdSwitch/mdSwitch.vue @@ -25,7 +25,10 @@ value: Boolean, id: String, disabled: Boolean, - type: String + type: { + type: String, + default: 'button' + } }, data() { return {