vue项目中引入elementUI库

mac2025-09-30  13

实现步骤:

1、使用npm 安装elementUI

npm install element-ui -S

2、在vue项目的入口js文件中全局引入elementUI库,增加以下三行代码:

import ElementUI from 'element-ui'; import 'element-ui/lib/theme-chalk/index.css'; Vue.use(ElementUI);

3、测试一下,在hello.vue文件中

<template> <div class="hello"> <h1>{{ msg }}</h1><br> <br> <el-button type="danger">这是element-ui的button组件</el-button> </div> </template>

4、效果如下:

最新回复(0)