vue+ elementUI confirm message 換行顯示提示信息


  我們平時遇到的提示信息都是一行展示的,但是最近的項目要求將不符合要求的數據全部換行展示。樣式如下:

  頂部提示信息message

 

 

 代碼實現如下:

let returnMsgList = [
    ”用戶’孫小小'的登錄手機號:138已占用,請修改“,
    ”用戶’孫xx'的登錄手機號:138已占用,請修改“
];
 // 最終展示數據 , 創建元素;
let newDatas = [],h = this.$createElement;
     // 循環數據 依次放入最終數據中
          for (const i in returnMsgList) {
            newDatas.push(h('p', null, returnMsgList[i]))
          }
    // 彈出優雅展示
          this.$message.error({
            message: h('div', null, newDatas)
          });    

  同理:confirm 提示信息 

代碼實現如下:

let returnMsgList = [
    ”用戶’孫小小'的登錄手機號:138已占用,請修改“,
    ”用戶’孫xx'的登錄手機號:138已占用,請修改“
];
let newDatas = [],h = this.$createElement;
        for (const i in returnMsgList) {
          newDatas.push(h('p', null, returnMsgList[i]))
        }
        _this.$confirm( h('div', null, newDatas), '提示', {
            confirmButtonText: '確定',
            cancelButtonText: '取消',
            type: 'warning'
          }).then(() => {
            this.$message({
              type: 'success',
              message: '已導入'
            }); 
          }).catch(() => {
            this.$message({
              type: 'info',
              message: '已取消導入'
            });          
        });

  代碼實現環境:vue+elementUI。

  


免責聲明!

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



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