Category:vue
Article From:https://www.cnblogs.com/foxcharon/p/9124861.html

We know that the basic usage of this thing is like this:

1 this.$message({
2           message: 'Congratulations, this is a success story. ',
3           type: 'success'
4 });

But I think this is still a bit troublesome, so I decided to directly plug it into the prototype of Vue.

 main.js 

Vue.prototype.$elementMessage = function (msg,t) {
  this.$message({
    message: msg,
    type: t
  })
}

When used:

this.$elementMessage('Please fill in the numbers! '','warning')

This is it。

Leave a Reply

Your email address will not be published. Required fields are marked *