网页特效栏目收集了最全最新的前端网页插件,包括最流行的jQuery,Bootstrap,Js,Css,Vue等主流特效插件。
一个微型的Vue.js应用程序,简单可自定义的(iOS风格)打开/关闭切换开关组件。
1.导入并注册开/关切换组件。
import OnoffToggle from 'vue-onoff-toggle';
new Vue({
components: {
OnoffToggle
}
})
2.将开/关切换组件添加到应用程序。
// default theme
<onoff-toggle v-model="checked" />
// iOS theme
<onoff-toggle v-model="checked" theme="ios" />
// Material Theme
<onoff-toggle v-model="checked" theme="material" />
new Vue({
components: {
OnoffToggle
},
data() {
return {
checked: false
}
}
})
3.具有默认值的可用组件道具。
value: { type: Boolean, default: false },
theme: { type: String, default: THEME_DEFAULT },
name: { type: String },
disabled: { type: Boolean, default: false },
onColor: { type: String },
offColor: { type: String },
thumbColor: { type: String },
borderColor: { type: String },
width: { type: [Number, String] },
height: { type: [Number, String] },
margin: { type: [Number, String] },
shadow: { type: Boolean, default: true }
转载请注明来源:Vue开关按钮组件(vue-onoff-toggle)仿ios开关切换
本文永久链接地址:https://www.moyouyouw.cn/code/1154.html
郑重声明:本站所有主题/文章除标明原创外,均来自网络转载,版权归原作者所有,如果有侵犯到您的权益,请联系本站删除,谢谢!我们不承担任何技术及版权问题,且不对任何资源负法律责任。
已有 位小伙伴发表了看法
欢迎 你 发表评论