进行修改操作的时候 修改的值没有实时改变,该怎么做呢?-灵析社区

我买了30万的鞋子

import { ref, reactive, getCurrentInstance, onMounted, nextTick } from "vue"; const { proxy } = getCurrentInstance(); const props = defineProps({ modelValue: { type: [Number,String], }, type: { type: Number, }, }); const api = { loadCategory: "/category/loadAllCategory4Select", }; const categoryList = ref([]); const loadCategory = async () => { let result = await proxy.Request({ url: api.loadCategory, params: { type: props.type, }, }); if (!result) { return; } categoryList.value = result.data; }; loadCategory(); const emit = defineEmits(["update:modelValue", "change"]); const onChange = (e) => { emit("update:modelValue", e); emit("change"); }; 进行修改操作的时候 修改的值没有实时改变,该怎么做呢? 进行修改操作的时候 修改的值没有实时改变,该怎么做呢?

阅读量:13

点赞量:0

问AI
~~ ":modelValue="modelValue"" 这里不应该是 "props.modelValue" 嘛? 别的地方好像没问题。 ~~ 搞了个 demo,是联动的 "https://stackblitz.com/edit/vitejs-vite-hha5mb?file=src%2FApp.vue,src%2Fstyle.css,src%2Fcomponents%2FHelloWorld.vue&terminal=dev" (https://link.segmentfault.com/?enc=J1D15OOTN8TqxzlOVpJnuw%3D%3D.zdlj%2FRWtvHLYMpL9RdNCgjVD0HRnBl30gU5L6COC6d8zj8hewVPkTwyv1RBv7cQkwuoz%2F9bWWgNEok6aoL2zPWOKA461nFWbbypm%2Bh1zkZNJVmJVkvJhWK0rcrd%2BhyN%2FfaXfuts3N%2B9KBz7%2BS8pcW4xeixYh6W45PFBC40EQwzwGrtBYNb8c24AKDGDJVc1I)