1.添加elementUI 插件,plugins->ele.js,代码如下
1 2 3 | import Vue from 'vue' import ElementUI from 'element-ui' Vue.use(ElementUI) |
在nuxt.config.js中配置这个插件
1 2 3 4 5 | plugins: [ '~/plugins/route' , {src: '~/plugins/ele' , ssr: true } ], |
2.引入element样式
1 2 3 | css: [ 'element-ui/lib/theme-chalk/index.css' ], |
好了,按照以往写element的语法写就行了。
1 | < el-button type = "primary" @ click = "openVn" >主要按钮</ el-button >0 |
1 2 3 4 | openVn() { this .$message( '这是一条消息提示' ); } |