Vue+Element-ui彈窗?this.$alert?is?not?a?function問題
Vue Element-ui彈窗 this.$alert is not a function
使用問題
Element-ui官網(wǎng)上單獨引用MessageBox的話需要在import中加入MessageBox。
但是在使用時報了this.$alert is not a function
解決辦法
在element.js中加入Vue.prototype.$XXX = MessageBox
在使用時用this. $XXX.alert
Vue element-ui 彈窗使用遇到的問題
彈窗里定義了表單使用遇到關(guān)閉彈窗再次開啟時會自動保存上一次的數(shù)據(jù)而不是重置初始數(shù)據(jù)的問題
解決代碼如下
<template> ? ? <el-form-item label> ? ? ? ? <el-button :loading="state" type="primary" @click="onSubmit('ruleForm')">保存</el-button> ? ? ? ? <el-button @click="handleClose('ruleForm')">取消</el-button> ? ? </el-form-item> </template> ? ? <script> export default { ? ? methods:{ ? ? ? ? ? ? ? ? handleClose(formName) { ? ? ? ? ? ? this.$refs[formName].resetFields(); ?//這句代碼重置彈窗里定義的表單數(shù)據(jù) ? ? ? ? } ? ? } } </script>
以上為個人經(jīng)驗,希望能給大家一個參考,也希望大家多多支持腳本之家。
相關(guān)文章
公共Hooks封裝報表導(dǎo)出useExportExcel實現(xiàn)詳解
這篇文章主要為大家介紹了公共Hooks封裝報表導(dǎo)出useExportExcel實現(xiàn)詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2022-12-12antdv的table因數(shù)據(jù)量過大導(dǎo)致的卡頓問題及解決
這篇文章主要介紹了antdv的table因數(shù)據(jù)量過大導(dǎo)致的卡頓問題及解決方案,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教2023-11-11使用websocket和Vue2中的props實時更新數(shù)據(jù)方式
這篇文章主要介紹了使用websocket和Vue2中的props實時更新數(shù)據(jù)方式,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教2024-08-08