createElement el-select(vue MessageBox 弹框)

export default {
  data() {
    return {
      optionList: ['a', 'd'],
      value: 'a'
    }
  },
  
  mounted() {
    this.selectDialog()
  },

  methods: {
    selectDialog() {
      const h = this.$createElement;
      const that = this
      this.$msgbox({
        title: "请选择数据",
        message: h('el-select', 
          {
            props: {
              value: that.value,
              filterable: true,
            },
            ref: 'selectView',
            on: {
              change:e => {
                that.value = e
                that.$refs.selectView.value = e  // select下拉框值改变,回显到页面上
              },
            },
          },
          [
            this.optionList.map(it => {
              return h('el-option', {
                props: {
                  label: it,
                  key: it,
                  value: it,
                },
              });
            })
          ]
        ),
        showCancelButton: true,
        closeOnClickModal: false,
        confirmButtonText: '确定', 
        cancelButtonText: '取消',
      }).then( _ => {
      	// 成功操作。。。。
      }).catch(msg => {
      	// 取消操作。。。。
      });
    }
  }
}

createElement el-select(vue MessageBox 弹框)

上一篇:基于C#的winform程序之登录系统


下一篇:2021-09-02