您的位置:首页 > 产品设计 > UI/UE

vue全家桶+element-UI搭建后台管理系统(1)“:构建项目并引入element-ui”

2018-03-05 14:45 1241 查看
1、:初始化,构建一个vue项目:
    vue init webpack Administrators;
? Project name mydemovue                        # => 项目名称
? Project description A Vue.js project          # => 项目描述
? Author malun <malun666@126.com>               # => 作者
? Vue build standalone                          # => 是否支持单文件组件
? Use ESLint to lint your code? Yes             # => 是否支持ESLint代码校验
? Pick an ESLint preset Standard                # => 校验的标准是什么?
? Setup unit tests with Karma + Mocha? Yes      # => 是否使用单元测试
? Setup e2e tests with Nightwatch? Yes          # => 是否使用e2e测试

2、:安装element-ui:
    cnpm i element-ui -S;具体安装请看这里点击打开链接
3、在项目中使用element-ui:
    在main.js引入,并使用:

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

Vue.use(ElementUI);4、查看效果:
    修改下components->HelloWorld.vue:
    <template>
<div>
<el-button @click="show = !show">Click Me</el-button>

<div style="display: flex; margin-top: 20px; height: 100px;">
<transition name="el-fade-in-linear">
<div v-show="show" class="transition-box">.el-fade-in-linear</div>
</transition>
<transition name="el-fade-in">
<div v-show="show" class="transition-box">.el-fade-in</div>
</transition>
</div>
</div>
</template>

<script>
export default {
data: () => ({
show: true
})
}
</script>

<style>
.transition-box {
margin-bottom: 10px;
width: 200px;
height: 100px;
border-radius: 4px;
background-color: #409EFF;
text-align: center;
color: #fff;
padding: 40px 20px;
box-sizing: border-box;
margin-right: 20px;
}
</style>



现在已经成功引入element-ui框架
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: