
错误代码
_c("el-table-column", {
attrs: { label: "性别", align: "center", prop: "gender" },
scopedSlots: _vm._u([
{
key: "default",
fn: function (scope) {
return [
_c("dict-tag", {
attrs: {
options: _vm.dict.type.sys_user_sex,
value: scope.row.gender,
},
}),
]
},
},
]),
}),
错误分析 _vm.dict is undefined 未定义
export default {
name: "Tb_user",
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 子表选中数据
checkedTbUserDetail: [],
// 非单个禁用
single: true,
少了 dicts: ['tb_user_status', 'sys_user_sex'], 但是代码是自动生成的,之前自动生成是有这行读取redis缓存的
export default {
name: "Tb_user",
dicts: ['tb_user_status', 'sys_user_sex'],
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 子表选中数据
checkedTbUserDetail: [],
就是少读取redis缓存字典
博客内容涉及到Vue.js应用中遇到的错误,问题在于表格组件尝试使用未定义的_dict变量来显示字典数据。错误分析指出,由于缺少从Redis缓存读取字典数据的代码行`dicts:['tb_user_status','sys_user_sex']`,导致了_dict在 Vue 实例的 data 函数中未初始化。解决方案是确保在数据加载时包含这部分字典数据。



1702

被折叠的 条评论
为什么被折叠?



