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

Element MessageBox彈框的具體使用

 更新時(shí)間:2020年07月27日 10:13:44   作者:ForeverJPB.  
這篇文章主要介紹了Element MessageBox彈框的具體使用,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧

組件—彈框

消息提示


<template>
 <el-button type="text" @click="open">點(diǎn)擊打開 Message Box</el-button>
</template>

<script>
 export default {
  methods: {
   open() {
    this.$alert('這是一段內(nèi)容', '標(biāo)題名稱', {
     confirmButtonText: '確定',
     callback: action => {
      this.$message({
       type: 'info',
       message: `action: ${ action }`
      });
     }
    });
   }
  }
 }
</script>

確認(rèn)消息


<template>
 <el-button type="text" @click="open">點(diǎn)擊打開 Message Box</el-button>
</template>

<script>
 export default {
  methods: {
   open() {
    this.$alert('這是一段內(nèi)容', '標(biāo)題名稱', {
     confirmButtonText: '確定',
     callback: action => {
      this.$message({
       type: 'info',
       message: `action: ${ action }`
      });
     }
    });
   }
  }
 }
</script>

提交內(nèi)容


<template>
 <el-button type="text" @click="open">點(diǎn)擊打開 Message Box</el-button>
</template>

<script>
 export default {
  methods: {
   open() {
    this.$prompt('請(qǐng)輸入郵箱', '提示', {
     confirmButtonText: '確定',
     cancelButtonText: '取消',
     inputPattern: /[\w!#$%&'*+/=?^_`{|}~-]+(?:\.[\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\w](?:[\w-]*[\w])?\.)+[\w](?:[\w-]*[\w])?/,
     inputErrorMessage: '郵箱格式不正確'
    }).then(({ value }) => {
     this.$message({
      type: 'success',
      message: '你的郵箱是: ' + value
     });
    }).catch(() => {
     this.$message({
      type: 'info',
      message: '取消輸入'
     });    
    });
   }
  }
 }
</script>

自定義


<template>
 <el-button type="text" @click="open">點(diǎn)擊打開 Message Box</el-button>
</template>

<script>
 export default {
  methods: {
   open() {
    const h = this.$createElement;
    this.$msgbox({
     title: '消息',
     message: h('p', null, [
      h('span', null, '內(nèi)容可以是 '),
      h('i', { style: 'color: teal' }, 'VNode')
     ]),
     showCancelButton: true,
     confirmButtonText: '確定',
     cancelButtonText: '取消',
     beforeClose: (action, instance, done) => {
      if (action === 'confirm') {
       instance.confirmButtonLoading = true;
       instance.confirmButtonText = '執(zhí)行中...';
       setTimeout(() => {
        done();
        setTimeout(() => {
         instance.confirmButtonLoading = false;
        }, 300);
       }, 3000);
      } else {
       done();
      }
     }
    }).then(action => {
     this.$message({
      type: 'info',
      message: 'action: ' + action
     });
    });
   }
  }
 }
</script>

使用 HTML 片段


<template>
 <el-button type="text" @click="open">點(diǎn)擊打開 Message Box</el-button>
</template>

<script>
 export default {
  methods: {
   open() {
    this.$alert('<strong>這是 <i>HTML</i> 片段</strong>', 'HTML 片段', {
     dangerouslyUseHTMLString: true
    });
   }
  }
 }
</script>

區(qū)分取消與關(guān)閉


<template>
 <el-button type="text" @click="open">點(diǎn)擊打開 Message Box</el-button>
</template>

<script>
 export default {
  methods: {
   open() {
    this.$alert('<strong>這是 <i>HTML</i> 片段</strong>', 'HTML 片段', {
     dangerouslyUseHTMLString: true
    });
   }
  }
 }
</script>

居中布局


<template>
 <el-button type="text" @click="open">點(diǎn)擊打開 Message Box</el-button>
</template>

<script>
 export default {
  methods: {
   open() {
    this.$confirm('此操作將永久刪除該文件, 是否繼續(xù)?', '提示', {
     confirmButtonText: '確定',
     cancelButtonText: '取消',
     type: 'warning',
     center: true
    }).then(() => {
     this.$message({
      type: 'success',
      message: '刪除成功!'
     });
    }).catch(() => {
     this.$message({
      type: 'info',
      message: '已取消刪除'
     });
    });
   }
  }
 }
</script>

全局方法

單獨(dú)引用

Options




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

相關(guān)文章

  • 詳解如何添加babel?polyfill

    詳解如何添加babel?polyfill

    這篇文章主要介紹了詳解vue如何添加babel?polyfill實(shí)現(xiàn)方法,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2023-06-06
  • vue2.0 移動(dòng)端實(shí)現(xiàn)下拉刷新和上拉加載更多的示例

    vue2.0 移動(dòng)端實(shí)現(xiàn)下拉刷新和上拉加載更多的示例

    本篇文章主要介紹vue2.0 移動(dòng)端實(shí)現(xiàn)下拉刷新和上拉加載更多的示例,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧
    2018-04-04
  • Vue?dialog模態(tài)框的封裝方法

    Vue?dialog模態(tài)框的封裝方法

    這篇文章主要為大家詳細(xì)介紹了Vue?dialog模態(tài)框的封裝方法,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2022-07-07
  • vue3.0實(shí)踐之寫tsx語法實(shí)例

    vue3.0實(shí)踐之寫tsx語法實(shí)例

    很久不寫博客了,最近在使用ts和tsx開發(fā)vue類項(xiàng)目,網(wǎng)上資料比較少,順便記錄一下方便同樣開發(fā)的人互相學(xué)習(xí)共同進(jìn)步,下面這篇文章主要給大家介紹了關(guān)于vue3.0實(shí)踐之寫tsx語法的相關(guān)資料,需要的朋友可以參考下
    2022-07-07
  • Element的Message彈窗重復(fù)彈出問題解決

    Element的Message彈窗重復(fù)彈出問題解決

    本文主要介紹了Element的Message彈窗重復(fù)彈出,文中通過示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2021-09-09
  • 解讀element?el-upload上傳的附件名稱不顯示?file-list賦值

    解讀element?el-upload上傳的附件名稱不顯示?file-list賦值

    這篇文章主要介紹了解讀element?el-upload上傳的附件名稱不顯示?file-list賦值問題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2022-10-10
  • Vue中img的src是動(dòng)態(tài)渲染時(shí)不顯示的解決

    Vue中img的src是動(dòng)態(tài)渲染時(shí)不顯示的解決

    今天小編就為大家分享一篇Vue中img的src是動(dòng)態(tài)渲染時(shí)不顯示的解決,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧
    2019-11-11
  • vue中刷新子組件重新加載子組件三種方法

    vue中刷新子組件重新加載子組件三種方法

    組件是Vue.js最強(qiáng)大的功能之一,組件可以擴(kuò)展HTML元素,封裝可重用的代碼,這篇文章主要給大家介紹了關(guān)于vue中刷新子組件重新加載子組件三種方法,文中通過代碼介紹的非常詳細(xì),需要的朋友可以參考下
    2023-12-12
  • Vue項(xiàng)目總結(jié)之webpack常規(guī)打包優(yōu)化方案

    Vue項(xiàng)目總結(jié)之webpack常規(guī)打包優(yōu)化方案

    這篇文章主要介紹了vue項(xiàng)目總結(jié)之webpack常規(guī)打包優(yōu)化方案,本文給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2019-06-06
  • vuex中Getter的用法詳解

    vuex中Getter的用法詳解

    這篇文章主要給大家介紹了關(guān)于Vuex中Getter的基本使用教程,getter相當(dāng)于Vuex中的計(jì)算屬性 對(duì) state 做處理再返回,本文通過示例代碼將Getter介紹的非常詳細(xì),需要的朋友可以參考下
    2021-07-07

最新評(píng)論