# 按钮 - Switch
# 示例
OFF
# 代码
点击查看源码
<template>
<div class="container">
<van-switch v-model="active"></van-switch>
</div>
</template>
<script>
export default {
data() {
return {
active: false,
}
},
}
</script>
<style>
</style>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
OFF
点击查看源码
<template>
<div class="container">
<van-switch v-model="active" active-color="red" inactive-color="yellow">
</van-switch>
</div>
</template>
<script>
export default {
data() {
return {
active: false,
}
},
}
</script>
<style>
</style>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17