Want to use this.$message ('message') in vue main.js;

want to use elementUI"s this.$message ("message") in vue main.js; change
to Vue.$message ("send"); don"t execute it, how to write

Mar.02,2021

import Vue from 'vue';
import { Message } from 'element-ui';

 Vue.prototype.$message = Message;

it's okay for me to use it this way. Did you report it wrong?

import Element from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'

Vue.use(Element)


this.$message.error('')

there is no way to use this method of this.$message in main.js. At this time, this points to window, and you have not registered this method for window

.

it can be introduced separately at this time

Can I use other features of
  

elementUI? Is there anything wrong with your use like this?

Menu