Vue2 学习记录

一、创建项目

1、vscode打开目录:D:\vueCode\test\hi

2、vue create hi01

3、选手手动配置( Manually select features)

4、按空格选中

5、回车,选择 Vue2

6、 Use history mode for router? no

7、 Pick a CSS pre-processor: less

完成项目创建

二、测试创建的项目

1、cd hi01

2、npm run serve

稍侯,一段时间后出现: http://localhost:8080/,看见vue经典界面表示项目创建成功。

三、element-ui 测试

1、进入官网地址:组件 | Element

2、npm i element-ui -S

3、main.js 引入:

......

import ElementUI from 'element-ui';

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

Vue.use(ElementUI);

......

main.js详细代码如下所示。

javascript 复制代码
import Vue from 'vue';
import App from './App.vue';
import router from './router';
import store from './store';
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';

Vue.use(ElementUI);

Vue.config.productionTip = false

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')

4、App.vue 引入

App.vue加入element测试组件(我这里使用button)

......

<el-row>

<el-button icon="el-icon-search" circle></el-button>

......

</el-row>

......

App.vue代码如下所示。

html 复制代码
<template>
  <div id="app">
<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>
    <nav>
      <router-link to="/">Home</router-link> |
      <router-link to="/about">About</router-link>
    </nav>
    <router-view/>
  </div>
</template>

<style lang="less">
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
}

nav {
  padding: 30px;

  a {
    font-weight: bold;
    color: #2c3e50;

    &.router-link-exact-active {
      color: #42b983;
    }
  }
}
</style>

5、测试

1、npm run serve

2、http://localhost:8080, 看见按钮

相关推荐
下午见。1 天前
【C语言学习笔记】动态内存分配:malloc/free的正确打开方式
c语言·笔记·学习
Rock_yzh1 天前
LeetCode算法刷题——49. 字母异位词分组
数据结构·c++·学习·算法·leetcode·职场和发展·哈希算法
Wayfreem1 天前
Spring AI Alibaba 学习之最简单的快速入门
人工智能·学习·spring
再玩一会儿看代码1 天前
Ken的Java学习之路——Java中关于面向对象
java·开发语言·经验分享·python·学习
Pluchon1 天前
硅基计划6.0 伍 JavaEE 网络原理
网络·网络协议·学习·tcp/ip·udp·java-ee·信息与通信
椰壳也可1 天前
06_作业基于CubeMx实现按键控制LED灯(裸机)(立芯嵌入式笔记)
笔记·stm32·学习
im_AMBER1 天前
Leetcode 52
笔记·学习·算法·leetcode
菜鸟‍2 天前
【前端学习】阿里前端面试题
前端·javascript·学习
wdfk_prog2 天前
[Linux]学习笔记系列 -- [kernel]kallsyms
linux·笔记·学习
!chen2 天前
CPP 学习笔记 语法总结
c++·笔记·学习