使用Element-ui组件中MessageBox组件中自定义消息message中使用input输入框怎么绑定state中的值,或者在确认按钮中怎么获取这个input的值.
export default {
data () {
return {
inputValue: ''
}
},
methods: {
open4() {
const h = this.$createElement;
this.$msgbox({
title: '消息',
message: h('p', null, [
h('span', null, '内容可以是 '),
h('i', { style: 'color: teal' }, 'VNode'),
h('input', null, this.inputValue)
]),
showCancelButton: true,
confirmButtonText: '确定',
cancelButtonText: '取消',
beforeClose: (action, instance, done) => {
if (action === 'confirm') {
instance.confirmButtonLoading = true;
instance.confirmButtonText = '执行中...';
setTimeout(() => {
done();
setTimeout(() => {
instance.confirmButtonLoading = false;
}, 300);
}, 3000);
} else {
done();
}
}
}).then(action => {
this.$message({
type: 'info',
message: 'action: ' + action
});
});
},
}
}
解决了吗,我使用了Dialog