cube-ui 為我們提供了腳手架,可以方便的迅速初始化一個 cube-ui 項目,里面有基本配置和基礎代碼,然后你就可以開始的使用它了。
1.執行命令
# 在當前目錄下初始化一個 cube-ui 項目
$ vue init cube-ui/cube-template
# 在當前目錄下創建一個叫application的文件夾,在里面初始化項目
$ vue init cube-ui/template some-sub-application
2.配置選擇
$ vue init cube-ui/cube-template
#在當前目錄中生成項目? Generate project in current directory? Yes A newer version of vue-cli is available. latest: 2.9.3 installed: 2.8.2 # 為你的項目起個名字 ? Project name cube-application-guide # 起你的項目寫一段描述 ? Project description A guide for cube application # 作者 ? Author AmyFoxFN <********.com> # 選擇vue種類,第一種是運行時編譯,第二種是只運行,建議選后者將編譯交給webpack並且體積要小大約30% ? Vue build (Use arrow keys) ❯ Runtime + Compiler: recommended for most users Runtime-only: about 6KB lighter min+gzip, but templates (or any Vue-specific HTML) are ONL Y allowed in .vue files - render functions are required elsewhere # 是否后編譯 ? Use post-compile? Yes # 按需引入組件還是全部引入 ? Import type Partly # 是否自定義主題,使用后編譯的情況下可用 ? Custom theme? Yes # rem 布局,使用后編譯的情況下可用 ? Use rem layout? No # 是否安裝vue-router ? Install vue-router? No # 是否用ESLint來規范你的代碼 ? Use ESLint to lint your code? Yes # 選擇一個ESLint預設標准 ? Pick an ESLint preset Standard # 是否建立單元測試 ? Set up unit tests No # 是否建立端對端測試 ? Setup e2e tests with Nightwatch? No
初始化遇到的問題:
運行 vue init 報錯,缺少必須的參數<template>
原因:缺少vue-cli