日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 前端技术 > vue >内容正文

vue

vue2.0 创建项目

發(fā)布時(shí)間:2025/3/20 vue 22 豆豆
生活随笔 收集整理的這篇文章主要介紹了 vue2.0 创建项目 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

準(zhǔn)備

  • 安裝淘寶 npm鏡像
    npm install -g cnpm --registry=https://registry.npm.taobao.org
  • 添加系統(tǒng)變量path的內(nèi)容
    因?yàn)閏npm會被安裝到D:\Program Files\nodejs\node_global下,而系統(tǒng)變量path并未包含該路徑。在系統(tǒng)變量path下添加該路徑即可正常使用cnpm。
    cnpm -v
    npm install -g @vue/cli
    查看版本(是否安裝成功):vue -V

    創(chuàng)建一個(gè)項(xiàng)目

    vue create project-name
    還原項(xiàng)目 在根目錄 cnpm install

  • Vue CLI v3.5.1 ┌───────────────────────────┐ │ Update available: 3.9.3 │ └───────────────────────────┘ ? Please pick a preset: (Use arrow keys) > default (babel, eslint)Manually select features

    選擇第二個(gè)

    Vue CLI v3.5.1 ┌───────────────────────────┐ │ Update available: 3.9.3 │ └───────────────────────────┘ ? Please pick a preset: Manually select features ? Check the features needed for your project: (Press <space> to select, <a> to toggle all, <i> to invert sele? Check the features needed for your project: (Press <space> to select, <a> to toggle all, <i> to invert sele? Check the features needed for your project: (Press <space> to select, <a> to toggle all, <i> to invert sele? Check the features needed for your project: (Press <space> to select, <a> to toggle all, <i> to invert sele? Check the features needed for your project:(*) Babel >(*) TypeScript( ) Progressive Web App (PWA) Support(*) Router(*) Vuex(*) CSS Pre-processors(*) Linter / Formatter( ) Unit Testing( ) E2E Testing

    這里既然選擇了typescript為什么還要用babel,這里是希望使用babel的編譯功能,ts生成es6代碼,再經(jīng)過babel編譯成es5代碼;
    選擇需要插件 使用空格選擇,回車進(jìn)行下一步

    ? Check the features needed for your project: Babel, TS, Router, Vuex, CSS Pre-processors, Linter ? Use class-style component syntax? Yes ? Use Babel alongside TypeScript for auto-detected polyfills? Yes ? Use history mode for router? (Requires proper server setup for index fallback in production) Yes ? Pick a CSS pre-processor (PostCSS, Autoprefixer and CSS Modules are supported by default): (Use arrow keys)? Pick a CSS pre-processor (PostCSS, Autoprefixer and CSS Modules are supported by default): > Sass/SCSS (with dart-sass) //注意選這個(gè) 最新版本都用這個(gè)實(shí)現(xiàn)了,用node-sass容易被墻Sass/SCSS (with node-sass)LessStylus ----------回車-------------- ? Pick a linter / formatter config: TSLint ----------回車----------------- ? Pick additional lint features: (Press <space> to select, <a> to toggle all, <i> to invert selection) >(*) Lint on save( ) Lint and fix on commit? Where do you prefer placing config for Babel, PostCSS, ESLint, etc.? In package.json(選擇把配置文件放在一個(gè)文件里) ? Save this as a preset for future projects? (y/N) n等待安裝完成� Generating README.md...� Successfully created project admin. � Get started with the following commands:$ cd admin$ npm run serve結(jié)束

    VSCode 內(nèi)置格式化插件導(dǎo)致代碼格式化會自動換行問題,解決辦法
    1、設(shè)置
    2、搜索 vetur
    3、右邊三個(gè)點(diǎn)按鈕,-> open settings.json
    添加以下代碼:

    "vetur.format.defaultFormatter.html": "js-beautify-html","vetur.format.defaultFormatter.js": "vscode-typescript","vetur.format.defaultFormatterOptions": {"js-beautify-html": {"wrap_attributes": "auto"},"prettyhtml": {"printWidth": 200,"singleQuote": false,"wrapAttributes": false,"sortAttributes": false}}

    轉(zhuǎn)載于:https://www.cnblogs.com/sands/p/11284621.html

    總結(jié)

    以上是生活随笔為你收集整理的vue2.0 创建项目的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。