mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
switch component docs
This commit is contained in:
parent
71a5e0afa5
commit
29fb1c5845
@ -14,6 +14,9 @@ export default {
|
|||||||
updateState(newState) {
|
updateState(newState) {
|
||||||
console.log('changing');
|
console.log('changing');
|
||||||
this.switchState = newState;
|
this.switchState = newState;
|
||||||
|
},
|
||||||
|
handleClick() {
|
||||||
|
alert('click');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -42,7 +45,7 @@ export default {
|
|||||||
```html
|
```html
|
||||||
<div class="page-switch">
|
<div class="page-switch">
|
||||||
<span class="page-switch-text">Switch state: {{switchStateText}}</span>
|
<span class="page-switch-text">Switch state: {{switchStateText}}</span>
|
||||||
<o2-switch class="page-switch-sample" :checked="switchState" :onChange="updateState"></o2-switch>
|
<o2-switch class="page-switch-sample" :checked="switchState" :on-change="updateState"></o2-switch>
|
||||||
<o2-switch class="page-switch-sample" :checked="false" :disabled="true"></o2-switch>
|
<o2-switch class="page-switch-sample" :checked="false" :disabled="true"></o2-switch>
|
||||||
</div>
|
</div>
|
||||||
```
|
```
|
||||||
|
@ -57,13 +57,6 @@ export default {
|
|||||||
toggleState: function() {
|
toggleState: function() {
|
||||||
if (this.disabled || this.loading) return;
|
if (this.disabled || this.loading) return;
|
||||||
this.onChange(!this.checked);
|
this.onChange(!this.checked);
|
||||||
},
|
|
||||||
|
|
||||||
/*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
getState: function() {
|
|
||||||
return this.checked;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user