使用vue-cli webpack 快速搭建項目的代碼
更新時間:2018年11月21日 09:44:27 作者:color_小浣熊
這篇文章主要介紹了vue-cli webpack 快速搭建項目的教程詳解,本文通過實例代碼給大家介紹的非常詳細,具有一定的參考借鑒價值,需要的朋友可以參考下
一、安裝vue
npm install vue -g
二、用vue-cli快速搭建項目
//全局安裝vue-cli npm install install -g vue-cli //創(chuàng)建一個基于webpack模板的項目 vue init webpack [demoname] ? Project name (xxx) ? Project name xxxx ? Project description (A Vue.js project) ? Project description A Vue.js project ? Author (xj <x@xm.com>) ? Author xx <x@xlm.com> ? Vue build (Use arrow keys) ? Vue build standalone ? Install vue-router? (Y/n) y ? Install vue-router? Yes ? Use ESLint to lint your code? (Y/n) n ? Use ESLint to lint your code? No ? Set up unit tests (Y/n) n ? Set up unit tests No ? Setup e2e tests with Nightwatch? (Y/n) n ? Setup e2e tests with Nightwatch? No ? Should we run `npm install` for you after the project has been created? (recom ? Should we run `npm install` for you after the project has been created? (recom mended) npm vue-cli · Generated "paixiaoyang_backstage". # Installing project dependencies ... # ======================== npm WARN deprecated browserslist@2.11.3: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools. npm WARN deprecated bfj-node4@5.3.1: Switch to the `bfj` package for fixes andnew features! npm WARN deprecated browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools. > uglifyjs-webpack-plugin@0.4.6 postinstall F:\work\paixiaoyang_backstage\paixiaoyang_backstage\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 ajv-keywords@3.2.0 requires a peer of ajv@^6.0.0 but none is installed. You must install peer dependencies yourself. npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}) added 1127 packages from 646 contributors and audited 10642 packages in 157.659s found 2 vulnerabilities (1 moderate, 1 high) run `npm audit fix` to fix them, or `npm audit` for details # Project initialization finished! # ======================== To get started: cd xxxx npm run dev Documentation can be found at https://vuejs-templates.github.io/webpack
三、進入項目運行
cd xxxx //運行 npm run dev
四、在瀏覽器上打開localhost:8080
總結(jié)
以上所述是小編給大家介紹的使用vue-cli webpack 快速搭建項目的代碼,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復(fù)大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!
相關(guān)文章
一文詳解vue-router中的導(dǎo)航守衛(wèi)
vue-router提供的導(dǎo)航守衛(wèi)主要用來通過跳轉(zhuǎn)或取消的方式守衛(wèi)導(dǎo)航,在 vue-router 中,導(dǎo)航守衛(wèi)是一種非常重要的功能,所以本文將詳細講解一下vue-router中的導(dǎo)航守衛(wèi),感興趣的同學跟著小編一起來看看吧2023-07-07vue本地打開build后生成的dist文件夾index.html問題
這篇文章主要介紹了vue本地打開build后生成的dist文件夾index.html問題,本文給大家介紹的非常詳細,具有一定的參考借鑒價值,需要的朋友參考下吧2019-09-09axios?發(fā)?post?請求,后端接收不到參數(shù)的完美解決方案
這篇文章主要介紹了axios?發(fā)?post?請求,后端接收不到參數(shù)的解決方案,場景很簡單,就是一個正常 axios post 請求,本文給大家分享問題原因分析及解決方案需要的朋友可以參考下2022-12-12IDEA創(chuàng)建Vue項目的兩種方式總結(jié)
這篇文章主要介紹了IDEA創(chuàng)建Vue項目的兩種方式總結(jié),具有很好的參考價值,希望對大家有所幫助。2023-04-04