Vue3 - 获取 Proxy 对象代理中包裹的 “真实数据“,解决对象或数组打印后是 Proxy 对象无法拿到原始数据的问题(免费)
·

方法 1:使用 toRaw 解除响应式
import { toRaw } from 'vue';
onChange: (keys, rows) => {
const normalRows = rows.map(row => toRaw(row));
console.log(normalRows);
formData.selectedRows = normalRows;
}
方法 2:JSON 深拷贝
onChange: (keys, rows) => {
const normalRows = JSON.parse(JSON.stringify(rows));
console.log(normalRows);
formData.selectedRows = normalRows;
}

更多推荐



所有评论(0)