带有PINIA NPM服务器错误变量的Vue.js分配了一个值,但从未使用过
我正在使用此视频 https:// https://www.youtube.com/watch?vv.v.v.v.v.v.v.v.v.v.vo = = ok6vo98rv_q& t = 108S ,但我不断遇到错误:“错误'counter'被分配了一个值,但从未使用过no-undused-vars”。我想念什么?
<template>
{{ counter }}
</template>
<script>
import { storeToRefs } from "pinia";
import useStore from "../store/useStore";
const main = useStore;
const { counter } = storeToRefs(main);
</script>
店铺:
import { defineStore } from "pinia";
// import { auth } from "./auth.module";
export const useStore = defineStore("main", {
state: () => ({
counter: null,
}),
});
I am using this video https://www.youtube.com/watch?v=Ok6vO98RV_Q&t=108s, but I keep getting the error: "error 'counter' is assigned a value but never used no-unused-vars". What am I missing?
<template>
{{ counter }}
</template>
<script>
import { storeToRefs } from "pinia";
import useStore from "../store/useStore";
const main = useStore;
const { counter } = storeToRefs(main);
</script>
store:
import { defineStore } from "pinia";
// import { auth } from "./auth.module";
export const useStore = defineStore("main", {
state: () => ({
counter: null,
}),
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须指定
&lt; script&gt;
对于构图API,否则您必须通过返回模板手动将属性曝光。
You have to specify
<script setup>
for Composition API or else you have to expose the properties manually to the template by returning them.