vue3——template中变量解包问题 2023-01-31 开发 1234567<n-form-item :label="`${filter.name}`" :label-width="`${labelWidth[filterIndex].value}px`" style="display: inline-grid; width: var(--item-width)" :key="filter.enName" v-for="(filter, filterIndex) in checkedFilters"> labelWidth 是一个 ComputedRef<ComputedRef[]> 类型的变量,在做字符串拼接的时候,如果没有写 .value 就会出现导致结构失败,属性丢失。 从表象去观察(volar 插件的提示信息),应该是template默认会解包第一层的数据,深层次的数据拿到后不能做计算、拼接等隐式转换的操作 https://blog.csdn.net/akkigg/article/details/127924553