Appearance
问题: Component emitted event "update:visible" but it is neither declared in the emits option nor as an "onUpdate:visible" prop. 代码:
js
// 父组件
<DialogUpdate
v-if="dialogUpdate"
:visible.sync="dialogUpdate"
:row-data="rowData"
@refresh="handleGetData"
/>
// 子组件
const $_visible = computed({
get() {
return props.visible;
},
set(val) {
emits('update:visible', val);
},
});
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
修复: 参考 搜索关键字:vue3 sync
js
// 父组件
<DialogUpdate
v-if="dialogUpdate"
v-model:visible="dialogUpdate"
:row-data="rowData"
@refresh="handleGetData"
/>
1
2
3
4
5
6
7
2
3
4
5
6
7
问题: Component emitted event "refresh" but it is neither declared in the emits option nor as an "onRefresh" prop.
代码:
js
const emits = defineEmits("refresh");
1
修复:
js
const emits = defineEmits(["refresh"]);
1
问题: 命名问题重叠问题。 代码:
js
const { total } = await postDataTypePage;
total.value = total;
1
2
2
修复:
js
const { total: totalCount } = await postDataTypePage;
total.value = totalCount;
1
2
2
问题: 由 setup 语法糖导致组件私有属性无法访问 代码:
vue
<script setup>
const str = ref('123')
const handleDel = () => { ... }
</script>
1
2
3
4
2
3
4
修复:
vue
<script setup>
const str = ref('123')
const handleDel = () => { ... }
defineExpose({(str, handleDel)})
</script>
1
2
3
4
5
2
3
4
5
问题: vuedraggable.js Cannot read properties of undefined (reading 'header')
修复:
js
// 升级最新版
npm install -S vuedraggable@next
1
2
2
问题: [@vue/compiler-sfc] ::v-deep usage as a combinator has been deprecated. Use :deep instead. 代码:
js
<style scoped lang="scss">
.preview-item ::v-deep .el-form-item{}
</style>
1
2
3
2
3
修复:
js
<style scoped lang="scss">
.preview-item :deep(.el-form-item){}
</style>
1
2
3
2
3