vue中如何使用js弹出elementUI的Dialog对话框?会弹MessageBox但不会弹Dialog

下面的代码不写HTML就可以弹一个elementUI的MessageBox 弹框

在不写HTML的情况下我想弹一个Dialog 里面有输入框什么的该怎么办呢?


import { MessageBox } from 'element-ui'

MessageBox(message, '错误', {
  confirmButtonText: '确定'
})
阅读 10.5k
2 个回答

MessageBox也可以有输入框啊
例子

<template>
  <el-button type="text" @click="open">点击打开 Message Box</el-button>
</template>

<script>
  export default {
    methods: {
      open() {
        this.$alert('这是一段内容', '标题名称', {
          confirmButtonText: '确定',
          callback: action => {
            this.$message({
              type: 'info',
              message: `action: ${ action }`
            });
          }
        });
      }
    }
  }
</script>

dialog官方教程
https://element.eleme.io/#/zh...

希望对您有用,欢迎关注我的微信公众号:前端指南
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题