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, 看见按钮

相关推荐
qeen874 小时前
【数据结构】建堆的时间复杂度讨论与TOP-K问题
c语言·数据结构·c++·学习·
lizhihai_995 小时前
股市学习心得-六张分时保命图
大数据·人工智能·学习
nashane5 小时前
HarmonyOS 6学习:应用签名文件丢失处理与更新完全指南
学习·华为·harmonyos·harmonyos 5
@codercjw5 小时前
公差的具体标注方法(书本上/理论上标注方法)
学习
久菜盒子工作室6 小时前
时寒冰:第五次产业大转移与未来30年国运:在“双向挤压”中实现惊险一跃
人工智能·学习
Amazing_Cacao7 小时前
CFCA精品可可产区认证课程风土解析(美洲):打破风味堆叠的假象,建立时间轴上的层次展开阅读系统
学习
永远不会的CC8 小时前
浙江华昱欣实习(4月23日~ 4月19日)
后端·学习
爱上好庆祝8 小时前
学习js的第五天
前端·css·学习·html·css3·js
qiaozhangchi8 小时前
求解器学习笔记
笔记·python·学习
bendandawugui8 小时前
PCIe协议学习-PCIe的No Snoop Attr使用
学习