Javascript 如何使用`<;脚本设置>;`?
Vue版本:Javascript 如何使用`<;脚本设置>;`?,javascript,vue.js,vuejs3,rfc,Javascript,Vue.js,Vuejs3,Rfc,Vue版本:3.0.11 使用以下代码: {{count}} 从“vue”导入{ref} 导出常量计数=ref(0) export const inc=()=>count.value++ 我得到: 错误无法编译,错误为1 ./src/views/HyperScript.vue中出错?vue&type=script&setup=true&lang=js 语法错误:TypeError:无法读取null的属性“content” @./src/views/HyperScript.vue?vue&ty
3.0.11
使用以下代码:
{{count}}
从“vue”导入{ref}
导出常量计数=ref(0)
export const inc=()=>count.value++
我得到:
错误无法编译,错误为1
./src/views/HyperScript.vue中出错?vue&type=script&setup=true&lang=js
语法错误:TypeError:无法读取null的属性“content”
@./src/views/HyperScript.vue?vue&type=script&setup=true&lang=js 1:0-2931:294-576 1:294-576
@./src/views/HyperScript.vue
@./src/router/index.ts
@./src/main.ts
@多(网页包)-开发服务器/客户端?http://192.168.6.175:8080&sockPath=/sockjs-node(webpack)/hot/dev-server.js./src/main.ts
您不需要在脚本中添加导出
:
<template>
<button @click="inc">{{ count }}</button>
</template>
<script setup>
import { ref } from 'vue'
const count = ref(0)
const inc = () => count.value++
</script>
{{count}}
从“vue”导入{ref}
常数计数=ref(0)
const inc=()=>count.value++
请您指出
的单据好吗?您可以查看此RFC