1. 程式人生 > 其它 >(1)初始化專案

(1)初始化專案

2019獨角獸企業重金招聘Python工程師標準>>> hot3.png

(1)初始化專案

1 使用vue-cli初始化專案

vue init webpack my-renren

得到以下輸出:

? Project name my-renren
? Project description A Vue.js project
? Author neumeng <[email protected]>
? Vue build standalone
? Install vue-router? No
? Use ESLint to lint your code? No? Set up unit tests No
? Setup e2e tests with Nightwatch? No
? Should we run `npm install` for you after the project has been created? (recommended) npm

   vue-cli · Generated "my-renren".


# Installing project dependencies ...
# ========================

npm WARN deprecated 
[email protected]
: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools. npm WARN deprecated [email protected]: Switch to the `bfj` package for fixes and new features! npm WARN deprecated [email protected]: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools. >
[email protected]
postinstall E:\VisualStudioCodeProjects\my-renren\node_modules\webpack\node_modules\uglifyjs-webpack-plugin > node lib/post_install.js npm notice created a lockfile as package-lock.json. You should commit this file. npm WARN [email protected] requires a peer of [email protected]
^6.0.0 but none is installed. You must install peer dependencies yourself. npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}) added 1126 packages from 646 contributors in 318.991s # Project initialization finished! # ======================== To get started: cd my-renren npm run dev Documentation can be found at https://vuejs-templates.github.io/webpack

得到的目錄結構如下表:

NameDescription
build專案構建(webpack)相關程式碼
config配置目錄,包括埠號等。我們初學可以使用預設的。
node_modulesnpm 載入的專案依賴模組
src這裡是我們要開發的目錄,基本上要做的事情都在這個目錄裡。
static靜態資源目錄,如圖片、字型等
.babelrcbabel配置檔案
.editorconfig編輯器配置檔案
.gitignoregit忽略配置檔案
.postcssrc.jspostcss配置檔案
index.html首頁入口檔案
package-lock.json記錄當前狀態下實際安裝的各個npm package的具體來源和版本號
package.json專案配置檔案
README.md專案的說明文件,markdown 格式

其中,src目錄裡面包含了幾個目錄及檔案:

  • assets:放置一些圖片,如logo等。
  • components:目錄裡面放了一個元件檔案,可以不用。
  • App.vue: 專案入口檔案,我們也可以直接將元件寫這裡,而不使用 components 目錄。
  • main.js: 專案的核心檔案。

轉載於:https://my.oschina.net/neumeng/blog/2248524