File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change 1
1
<script setup lang="ts">
2
2
import Switch from " ../lib/Switch.vue"
3
+ import {ref } from " vue" ;
4
+ let status = ref (false )
3
5
</script >
4
6
<template >
5
- <Switch />
7
+ <Switch v-model = " status " />
6
8
</template >
7
9
8
10
<style lang="scss" scoped>
Original file line number Diff line number Diff line change 1
1
<script setup lang="ts">
2
- import { ref } from " vue " ;
3
- let status = ref ( false )
2
+ const props = defineProps ([ ' modelValue ' ])
3
+ const emits = defineEmits ([ ' update:modelValue ' ] )
4
4
const onClick = ()=> {
5
- status . value = ! status . value
5
+ emits ( ' update:modelValue ' , ! props . modelValue )
6
6
}
7
7
</script >
8
8
9
9
<template >
10
- <div class =" zw-switch" :class =" status ?'zw-switch-on':''" @click =" onClick" >
10
+ <div class =" zw-switch" :class =" props.modelValue ?'zw-switch-on':''" @click =" onClick" >
11
11
<span class =" node" ></span >
12
12
</div >
13
13
</template >
You can’t perform that action at this time.
0 commit comments