head-img Force's Blog

[VuePoem] Vue2升级到Vue3及elementUI升级到Plus常见报错及修复办法

PHP

本文如果帮到您,请给个评论支持下。谢谢!

Uncaught (in promise) TypeError: Failed to set an indexed property on 'CSSStyleDeclaration': Indexed property setter is not supported.

原因分析:因使用了<el-table :cell-style="tableStyle"/>,methods返回字符串样式导致的报错
解决办法:将tableStyle逻辑中返回的字符串修改为对象

tableStyle({row, column, rowIndex, columnIndex}) {
    //return 'background:#009688; color:#fff!important;';
    return { 'background':'#009688', 'color':'#fff!important' };
},

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'row')

原因分析:因在<el-table><el-table-column>中使用<template slot-scope="scope">导致的报错
解决办法:将<template slot-scope="scope">替换为<template #default="scope">

<el-table
    :data="tableData">
    <el-table-column>
        <template slot-scope="scope"> //不要了 
        <template #default="scope"> //替换为
        ...

runtime-core.esm-bundler.js:38 [Vue warn]: Invalid prop: validation failed. Expected one of ["", "default", "small", "large"], got value "mini".

原因分析:在<el-button/><el-form/><el-table/><el-input/>等组件中使用了size="mini"或者不在["", "default", "small", "large"]范围内属性。
解决办法:直接按需替换,例如:

<el-button
    size="mini"  //删除
    size="small" //替换为
    ...
 <el-table
    size="mini" //删除
    size="small" //替换为
    ...

destroyed()beforeDestroy ()无效

解决办法:destroyed() 替换为unmounted ()beforeDestroy()替换为beforeUnmount

本文如果帮到您,请给个评论支持下。谢谢!

点我评论
打赏本文
二维码


125

文章

14

标签

 访客统计  Update-******