vue.esm.js?efeb:628 [Vue warn]: Property or method “handleClose“ is not defi

问题:

vue.esm.js?efeb:628 [Vue warn]: Property or method "handleClose" is not defi

原因:
使用ElementUI的温馨提示时,没写方法handleClose

vue
    <el-dialog
      title="温馨提示"
      :visible.sync="dialogVisible"
      width="30%"
      :before-close="handleClose">
      <span>请输入账号和密码</span>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
      </span>
    </el-dialog>

在vue中加入以下代码:

 handleClose(done){
        this.$confirm('确定关闭吗').then(() => {
          // function(done),done 用于关闭 Dialog
          done();

          console.info("点击右上角 'X' ,取消按钮或遮罩层时触发");
        }).catch(() => {

          console.log("点击确定时触发");
        });
      }

版权声明:本文为lisa2017_原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。