File tree Expand file tree Collapse file tree 6 files changed +47
-54
lines changed Expand file tree Collapse file tree 6 files changed +47
-54
lines changed Original file line number Diff line number Diff line change @@ -510,20 +510,7 @@ components:
510510 <span slot =" on" >SomeOnLabel</span > <!-- defaults to On -->
511511</switch >
512512```
513- [ demo] ( https://paulpflug.github.io/vue-materialize/#!/forms/switch ) - [ source for demo] ( dev/forms/switch.vue )
514- #### Props <sup >[ top^] ( #table-of-contents ) </sup >
515- | Name | type | default | description |
516- | ---:| --- | ---| --- |
517- | is-on | Boolean | false | (two-way) toggle state |
518- | disabled | Boolean | false | is disabled |
519-
520- #### Events <sup >[ top^] ( #table-of-contents ) </sup >
521- | Name | description |
522- | ---:| --- | ---| --- |
523- | off | will be emitted on click when state was on |
524- | on | will be emitted on click when state was off |
525- | toggle | will be emitted on click |
526-
513+ [ demo] ( https://paulpflug.github.io/vue-materialize/#!/forms/switch ) - [ source for demo] ( dev/forms/switch.vue ) - [ doc: vue-toggle] ( https://github.com/vue-comps/vue-toggle )
527514
528515### input-field <sup >[ top^] ( #table-of-contents ) </sup >
529516``` coffee
@@ -556,6 +543,7 @@ dataError | String | - | message to display on invalid input. Used with validate
556543dataSuccess | String | - | message to display on valid input. Used with validate
557544label | String | - | description of the input
558545value | String | - | preset the value
546+ placeholder | String | - | sets a placeholder
559547length | Number | 0 | maximum length of input
560548
561549#### Events <sup >[ top^] ( #table-of-contents ) </sup >
Original file line number Diff line number Diff line change 11<template lang="jade">
22.container
3- p
4- a(href="https://github.com/paulpflug/vue-materialize/blob/master/dev/forms/switch.vue") source
5- p
6- switch(@on="onOn" @off="onOff" @toggle="onToggle")
7- p
8- switch(disabled)
3+ br
4+ switch(@on="onOn" @off="onOff" @toggle="onToggle")
5+ p disabled:
6+ switch(disabled)
97 p Open console for events
8+ br
9+ a(href="https://github.com/paulpflug/vue-materialize/blob/master/dev/forms/switch.vue") source
10+
1011
1112</template >
1213
1314<script lang="coffee">
1415require (" ../materialize.config.scss" )
1516module .exports =
1617 components :
17- " switch" : require " ../../src/switch.vue "
18+ " switch" : require " ../../src/switch.coffee "
1819 methods :
1920 onOn : ->
2021 console .log " isOn"
Original file line number Diff line number Diff line change 3636 "vue-toaster" : " ^0.1.3" ,
3737 "vue-drag-handle" : " ^0.2.0" ,
3838 "vue-zoombox" : " ^0.1.0" ,
39- "vue-textarea" : " ^0.2.0"
39+ "vue-textarea" : " ^0.2.0" ,
40+ "vue-toggle" : " ^1.0.1"
4041 },
4142 "devDependencies" : {
4243 "callback-loader" : " ^0.2.4" ,
Original file line number Diff line number Diff line change 11# out: ../dropdown.js
22Velocity = require (" velocity-animate" )
33ci = require " vue-comps-dropdown"
4+ ci .computed ?= {}
5+ ci .computed .mergeClass = ->
6+ return [" dropdown-content" ]
47ci .props .transitionIn .default = ({el,cb}) ->
58 Velocity el, " stop"
69 Velocity el, " slideDown" ,{
Original file line number Diff line number Diff line change 1+ # out: ../switch.js
2+
3+ toggle = require " vue-toggle"
4+ t =
5+ template : """
6+ <div :class='computedClass'>
7+ <label>
8+ <slot name='off'>Off</slot>
9+ <input type='checkbox' v-model='isOn' v-bind:disabled='disabled'>
10+ <span class='lever'></span>
11+ <slot name='on'>On</slot>
12+ </label>
13+ </div>
14+ """
15+ mixins : toggle .mixins
16+ props :
17+ onClass : toggle .props .onClass
18+ offClass : toggle .props .offClass
19+ isOn : toggle .props .isOn
20+ disabled : toggle .props .disabled
21+ class :
22+ default : " switch"
23+ computed : toggle .computed
24+ watch :
25+ isOn : (val ) ->
26+ if val
27+ @ $emit (" on" )
28+ else
29+ @ $emit (" off" )
30+ @ $emit (" toggle" )
31+
32+ module .exports = t
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments