vue3速成
插件: volar
vue3模板
<template>
如何快捷键生成自行百度
</template>
<script lang="ts" setup>
import { ref } from 'vue'
</script>
<style scoped></style>
父传子prop、发射器emit、计算属性
<script lang="ts" setup>
import { computed, ref } from 'vue'
const props = defineProps({
value: Boolean,
});
const emit = defineEmits(['update:value', 'ok', 'cancel']);
const show = computed({
get() {
return props.value;
},
set(value) {
emit('update:value', value);
},
});
</script>
pinia使用
import { useAppStore } from '@/store/store';
const store = useAppStore()
const logout = () => {
store.logout()
}