1.安裝node
node -v查詢(xún)版本號(hào)
2.安裝vue
官方鏡像
npm install -g @vue/cli
可能中途會(huì)卡住
推薦淘寶鏡像
?npm? install? -g? cnpm? --registry=https://registry.npm.taobao.org
然后安裝最新版
cnpm i -g vue @vue/cli
3.新建vue項(xiàng)目
vue create vue-project
4.vue/cli 4.3.1的配置參考下面告私,選擇需要的功能劫拢。
https://www.cnblogs.com/jasonLiu2018/p/11986917.html
5.結(jié)束
cd vue-project
npm run dev
可能出現(xiàn)vue : 無(wú)法加載文件,下面方法解決先朦。
1. 以管理員身份運(yùn)行PowerShell
2.執(zhí)行:get-ExecutionPolicy,回復(fù)Restricted鞍陨,表示狀態(tài)是禁止的
3.執(zhí)行:set-ExecutionPolicy RemoteSigned
4.選擇Y
6.加路由
npm install vue-router --save-dev
6.1 在App.vue 中添加?<router-link to="/demo1">Demo1</router-link>
6.2 創(chuàng)建 demo1.vue
<template>
? <div class="test">
? ? <h1>This is an Demo1 page</h1>
? </div>
</template>
<script>
</script>
<style lang="">
</style>
6.3? ?/src/router/index.js中添加一路由
啟動(dòng)項(xiàng)目,打開(kāi) http://localhost:8080/#/demo1
加element-UI噪猾。
npm i element-ui -S
在main.js文件中 引入 element 組件? :
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
????Vue.use(ElementUI)
下圖主要按鈕表示成功了磕秤。