欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

element中的$confirm的使用

 更新時(shí)間:2020年04月26日 10:35:08   作者:yang  
這篇文章主要介紹了element中的$confirm的使用,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧

可以諸如此類的封裝一下

/*
 * 公用提示窗
 * @export
 * @param {string}[desc="確認(rèn)操作"]彈框提示文字
 * @param {string}[title="提示"]彈框標(biāo)題
 * @param{string}[confirmButtonName ='確認(rèn)']確認(rèn)按鈕文字
 * @param {string}[cancelButtonName="取消"] 取消按鈕文字
 * @param{boolean}[distinguishCancelAndClose = false]關(guān)系和取消是否執(zhí)行同一方法
 *@return
 *
 */
export function confirm (desc = '確認(rèn)操作', title = '提示', confirmButtonName = '確認(rèn)', cancelButtonName = '取消', distinguishCancelAndClose = false) {
 return this.$confirm(desc, title, {
  confirmButtonName: confirmButtonName,
  cancelButtonName: cancelButtonName,
  distinguishCancelAndClose: distinguishCancelAndClose,
  closeOnClickModel: false,
  type: 'warning',
  center: true
 })
}
xxx//vue
submitSome(){
  try(){
    async utils.confirm.call(this,"確認(rèn)要?jiǎng)h除嗎")
    const formData = {
      'id':this.id
    }
    let res = await this.$post('/sss',formData)
    if(res.code===1){
     //do something
    }
  }catch(e){
   console.log(e)
   // 如果需要關(guān)閉和取消有所區(qū)別
   if(e==='close'){
    //do something
   }else if(e==='cancel'){
    //do something
   }
  }
}

this.$confirm確定框內(nèi)容換行顯示

// 把寫的提示信心需要換行的地方分成數(shù)組 confirmText 
const confirmText = ['是否將此項(xiàng)移除?', '注意:移除后不可恢復(fù)。'] 
const newDatas = [] 
const h = this.$createElement 
for (const i in confirmText) { 
   newDatas.push(h('p', null, confirmText[i])) 
} 
 this.$confirm( 
   '提示', 
   { 
     title: '提示', 
     message: h('div', null, newDatas), 
     showCancelButton: true, 
     confirmButtonText: '確定', 
     cancelButtonText: '取消', 
     type: 'warning' 
   } ).then(() => { })

到此這篇關(guān)于element中的$confirm的使用的文章就介紹到這了,更多相關(guān)element $confirm 內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評(píng)論