mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
docs(Tag): use composition api
This commit is contained in:
parent
afd3474da3
commit
9fbda243cf
@ -48,16 +48,19 @@ app.use(Tag);
|
||||
```
|
||||
|
||||
```js
|
||||
import { ref } from 'vue';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
show: true,
|
||||
setup() {
|
||||
const show = ref(true);
|
||||
const close = () => {
|
||||
show.value = false;
|
||||
};
|
||||
|
||||
return {
|
||||
show,
|
||||
close,
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
close() {
|
||||
this.show = false;
|
||||
},
|
||||
},
|
||||
};
|
||||
```
|
||||
|
@ -58,16 +58,19 @@ app.use(Tag);
|
||||
```
|
||||
|
||||
```js
|
||||
import { ref } from 'vue';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
show: true,
|
||||
setup() {
|
||||
const show = ref(true);
|
||||
const close = () => {
|
||||
show.value = false;
|
||||
};
|
||||
|
||||
return {
|
||||
show,
|
||||
close,
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
close() {
|
||||
this.show = false;
|
||||
},
|
||||
},
|
||||
};
|
||||
```
|
||||
|
@ -63,6 +63,8 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { ref } from 'vue';
|
||||
|
||||
export default {
|
||||
i18n: {
|
||||
'zh-CN': {
|
||||
@ -98,16 +100,16 @@ export default {
|
||||
},
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
show: true,
|
||||
setup() {
|
||||
const show = ref(true);
|
||||
const close = () => {
|
||||
show.value = false;
|
||||
};
|
||||
},
|
||||
|
||||
methods: {
|
||||
close() {
|
||||
this.show = false;
|
||||
},
|
||||
return {
|
||||
show,
|
||||
close,
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
Loading…
x
Reference in New Issue
Block a user