vuejs error message code example
Example 1: vue.$Message
<template>
<vm-button :plain="true" @click="open">打开消息提示</vm-button>
<vm-button :plain="true" @click="openVn">VNode</vm-button>
</template>
<script >
export default {
methods: {
open() {
this.$message('这是一条消息提11111111111示');
},
openVn() {
const h = this.$createElement;
this.$message({
message: h('p', {
style: {
display: 'inline-block',
margin: 0
}
}, [
h('span', null, '内容可以是 '),
h('i', {style: 'color: teal'}, 'VNode')
])
});
}
}
}
</script>
Example 2: vue.$Message
<template>
<vm-button :plain="true" @click="open">打开消息提示</vm-button>
<vm-button :plain="true" @click="openVn">VNode</vm-button>
</template>
<script >
export default {
methods: {
open() {
this.$message('这是一条消息提示11111111111121sd让我测测为我测测为我饿二吃辣丹尼斯点击为我IE我嫩问我呢我呢我呢wine问问');
},
openVn() {
const h = this.$createElement;
this.$message({
message: h('p', {
style: {
display: 'inline-block',
margin: 0
}
}, [
h('span', null, '内容可以是 '),
h('i', {style: 'color: teal'}, 'VNode')
])
});
}
}
}
</script>