elementUI 通用确认框


Util.vue

<script>
  import VueResource from 'vue-resource'

  function confirm(_this, operate, fun) {
    const h = _this.$createElement;
    _this.$msgbox({
      title: '操作确认',
      message: h('p', null, [
        h('span', null, '你是否确认 '),
        h('i', { style: 'color: #409EFF' }, operate)
      ]),
      showCancelButton: true,
      confirmButtonText: '确定',
      cancelButtonText: '取消',
      callback: action=>{
        if(action==='confirm')
          fun()
      }
    })
  }
  export default{
    confirm
  }
</script>

 

main.js相关代码

import Utils from './Util.vue'

Vue.prototype.Utils = Utils

 

调用

        let fun = ()=>{
          this.$http.post(BASE_URL+'spider/run', row, {emulateJSON : true}).then((response) => {
            this.getData(this.currentPage)
          }, (response) => {})
        }
        this.Utils.confirm(this, '启动爬虫', fun)

 

效果

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM