vue3.x+element-plus [Vue warn]信息


最近需要把之前的vue2.x的項目遷移成3.x的,記錄一下遷移過程中遇到的[Vue warn]信息,以便其他項目使用

  • [Vue warn]: Missing required prop: "modelValue"
    [Vue warn]: Extraneous non-props attributes (visible) were passed to component but could not be automatically inherited because component renders fragment or text root nodes.
<el-dialog
  :title="'打開彈窗'"
  v-model:visible="dialogFormVisible"
  :close-on-click-modal="false"
>
</el-dialog>

v-model:visible="xxx"改為v-model="xxx"即可

<el-dialog
  :title="'打開彈窗'"
  v-model="dialogFormVisible"
  :close-on-click-modal="false"
>
</el-dialog>

[Vue warn]: Extraneous non-props attributes (width) were passed to component but could not be automatically inherited because component renders fragment or text root nodes.

<el-popconfirm
  width="200"
  title="確定刪除此條數據嗎?"
  @onConfirm="deleteRow(row.id)"
>
</el-popconfirm>

刪除width="xxx"

<el-popconfirm
  title="確定刪除此條數據嗎?"
  @onConfirm="deleteRow(row.id)"
>
</el-popconfirm>
  • [Vue warn]: Extraneous non-emits event listeners (onConfirm) were passed to component but could not be automatically inherited because component renders fragment or text root nodes. If the listener is intended to be a component custom event listener only, declare it using the "emits" option.
<el-popconfirm
  title="確定刪除此條數據嗎?"
  @onConfirm="deleteRow(row.id)"
>
  <template #reference>
    <el-button type="primary" size="small" icon="el-icon-delete">刪除</el-button>
  </template>
</el-popconfirm>

@onConfirm改為@confirm

<el-popconfirm
  title="確定刪除此條數據嗎?"
  @confirm="deleteRow(row.id)"
>
  <template #reference>
    <el-button type="primary" size="small" icon="el-icon-delete">刪除</el-button>
  </template>
</el-popconfirm>
  • [Vue warn]:Unhandled error during execution of render function ...
getList() {
  請求方法({
    參數名:參數值
  }).then((res) => {
    console.log("列表", res);
    if (res.code === 200) {
      this.list = res.data;
    }
  });
},

獲取列表時,返回值賦值錯誤

getList() {
  請求方法({
    參數名:參數值
  }).then((res) => {
    console.log("列表", res);
    if (res.code === 200) {
      this.list = res.data.list;
    }
  });
},


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM