老师你好,请问一下我这个代码为什么会报错。ref
中不可以使用对象吗
import { defineComponent, ref, toRefs,reactive, computed } from "vue";
interface DataProps {
count: number;
increase: () => void;
double: number;
}
export default defineComponent({
name: "Home",
setup() {
// reactive
const data: DataProps = ref({
count: 0,
increase: () => {
data.count++;
},
double: computed(() => {
return data.count * 2;
}),
});
return {
data
};
},
});