vue2和vue3的區別


一、常用命令

vue -V 查看本地 vue 版本

二。官方文檔

3.0:https://cli.vuejs.org/zh/

三、創建文件

3.0:vue create 進入工程文件夾,創建項目。

2.0:vue init webpack

四、啟動項目

3.0啟動npm run serve
2.0啟動npm run dev

五、目錄結構。

 

 build沒了、config沒了、哦對了還有最重要的一點,3.0的安裝項目時自動下載node-model。

在根目錄下創建一個vue.config.js

 

module.exports = {
    baseUrl: process.env.NODE_ENV === 'production' ? '/online/' : '/',
    // outputDir: 在npm run build時 生成文件的目錄 type:string, default:'dist'
    // outputDir: 'dist',
    // pages:{ type:Object,Default:undfind } 
    devServer: {
        port: 8888, // 端口號
        host: 'localhost',
        https: false, // https:{type:Boolean}
        open: true, //配置自動啟動瀏覽器
        // proxy: 'http://localhost:4000' // 配置跨域處理,只有一個代理
        proxy: {
            '/api': {
                target: '<url>',
                ws: true,
                changeOrigin: true
            },
            '/foo': {
                target: '<other_url>'
            }
        },  // 配置多個代理
    }
}

  

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM