源代码
<template>
<div>
<h2>Interactive Messager</h2>
<LinkButton @click="confirm()">Confirm</LinkButton>
<LinkButton @click="prompt()">Prompt</LinkButton>
</div>
</template>
<script>
export default {
methods: {
confirm() {
this.$messager.confirm({
title: "Confirm",
msg: "Are you confirm this?",
result: r => {
if (r) {
alert("confirmed: " + r);
}
}
});
},
prompt() {
this.$messager.prompt({
title: "Prompt",
msg: "Please type something",
result: r => {
if (r) {
alert("you type: " + r);
}
}
});
}
}
};
</script>