使用vue搭建应用二加入element
安装使用 element
1.安装
yarn add element-ui
2.使用
(1)在 main.js 中引入 element
main.js 为修改
import Vue from 'vue'
import App from './App'
import router from './router'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css' Vue.config.productionTip = false Vue.use(ElementUI) /* eslint-disable no-new */
new Vue({
el: '#app',
router,
render: h => h(App)
})
(2)简单应用
修改 src/components/HelloWorld.vue
<template>
<div class="hello">
<h1>{{ msg }}</h1>
<el-row>
<el-button icon="el-icon-search" circle></el-button>
<el-button type="primary" icon="el-icon-edit" circle></el-button>
<el-button type="success" icon="el-icon-check" circle></el-button>
<el-button type="info" icon="el-icon-message" circle></el-button>
<el-button type="warning" icon="el-icon-star-off" circle></el-button>
<el-button type="danger" icon="el-icon-delete" circle></el-button>
</el-row>
</div>
</template>
<script>
export default {
name: 'HelloWorld',
data () {
return {
msg: 'Welcome to Your Vue.js App'
}
}
}
</script> <!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h1, h2 {
font-weight: normal;
}
</style>
重新启动,预览 http://localhost:8080,变为

(3)修改路由
将src下的components改为views,在views下添加页面Login.vue、Home.vue、404.vue
Login.vue
Home.vue
404.vue
修改src/router/index.js,添加对应的路由
import Vue from 'vue'
import Router from 'vue-router'
import Login from '@/views/Login'
import Home from '@/views/Home'
import NotFound from '@/views/404' Vue.use(Router) export default new Router({
routes: [
{
path: '/',
name: 'Home',
component: Home
}, {
path: '/login',
name: 'Login',
component: Login
}
, {
path: '/404',
name: 'NotFound',
component: NotFound
}
]
})
重新启动服务
http://localhost:8080/#/

http://localhost:8080/#/login显示Login页面
使用vue搭建应用二加入element的更多相关文章
- vue项目搭建 (二) axios 封装篇
vue项目搭建 (二) axios 封装篇 项目布局 vue-cli构建初始项目后,在src中进行增删修改 // 此处是模仿github上 bailicangdu 的 ├── src | ├── ap ...
- 二、Electron + Webpack + Vue 搭建开发环境及打包安装
目录 Webpack + Vue 搭建开发环境及打包安装 ------- 打包渲染进程 Electron + Webpack 搭建开发环境及打包安装 ------- 打包主进程 Electron + ...
- Electron-vue实战(一)—搭建项目与安装Element UI
Electron-vue实战—搭建项目与安装Element UI 作者:狐狸家的鱼 本文链接 GitHub:sueRimn 一.新建项目1.初始化项目打开cmd,新建一个项目,我使用的是electro ...
- Vue小项目二手书商城:(一)准备工作、组件和路由
本项目基于vue2.5.2,与低版本部分不同之处会在(五)参考资料中提出 完整程序:https://github.com/M-M-Monica/bukesi 实现内容: 资源准备(mock数据) 组件 ...
- 深入浅出的webpack构建工具--webpack4+vue搭建环境 (十三)
深入浅出的webpack构建工具--webpack4+vue搭建环境 (十三) 从上面一系列的webpack配置的学习,我们现在来使用webpack来搭建vue的开发环境.首先我们来设想下我们的项目的 ...
- vue搭建骨架屏步骤配置
1.什么是骨架屏幕? 在页面加载数据之前,有一段空白时间,要么用loading加载,要么就用骨架屏. 在开发webapp的时候总是会受到首屏加载时间过长的影响,主流的解决方法是在载入完成之前显示loa ...
- Vue 搭建项目
Vue 搭建项目 一.node下载安装: 1.下载:https://nodejs.org/en/download/ 2.安装默认许选择,下一步就行: 3.安装完之后就可以使用npm命令 二.通过@v ...
- (原创)LAMP搭建之二:apache配置文件详解(中英文对照版)
LAMP搭建之二:apache配置文件详解(中英文对照版) # This is the main Apache server configuration file. It contains the # ...
- Selenium终极自动化测试环境搭建(二)Selenium+Eclipse+Python
Selenium终极自动化测试环境搭建(二)Selenium+Eclipse+Python 前面举例了Selenium+Eclipse+Junit+TestNG自动化测试环境的搭建,在前一篇的基础上, ...
随机推荐
- 转载于山边小溪的博客--编写跨浏览器兼容的 CSS 代码的金科玉律
http://www.cnblogs.com/lhb25/archive/2010/06/19/1760786.html 原始网页 作为 Web 设计师,你的网站在各种浏览器中有完全一样的表现是很 ...
- UI系统综述:iOS的图形绘制、动画与runloop
一.一条业务pipeline: 一个连接核心:coreanimation 二.两个进程: 1.app进程: 2.render进程: 首先,由 app 处理事件(Handle Events),如:用户的 ...
- uni验证码60秒倒计时
其实要实现这个功能原理非常简单,就是setInterval+setTimeout+clearInterval结合使用,首先在data里定义一个变量second,初始值为60,然后在setInterva ...
- java 调度框架quartz
核心代码如下: public class SchedulerTest { public static void main(String[] args) { //创建schedulerFactory类 ...
- 13.go内置的rate包学习1
package main import ( "context" "fmt" "golang.org/x/time/rate" "l ...
- C# 其它模拟延迟
System.Threading.Thread.Sleep(3000);//模拟延迟 如模拟上传图片等
- stack的简单用法总结
stack中常见方法 top():返回一个栈顶元素的引用,类型为 T&.如果栈为空,返回值未定义. push(const T& obj):可以将对象副本压入栈顶.这是通过调用底层容器的 ...
- Shared Virtual Memory (SVM) Functions
Description Shared Virtual Memory (SVM) (Glossary): An address space exposed to both the host and th ...
- 【luoguP2994】[USACO10OCT]吃晚饭的时候Dinner Time
题目链接 按顺序对于每个座位找一个最近的同时编号最小的牛就行了 #include<iostream> #include<cstring> #include<cstdio& ...
- vue指令用法
vue指令 指令式带有 v- 前缀的特殊特性v-text和v-html都属于指令将数据和dom做关联,当表达式的值改变时,响应式地作用在视图 解决大胡子语法闪烁案例 [v-cloak] { dispa ...