新建vue项目注意事项

1.在main.js中需要添加一个配置的东西

// 是否使用生产模式改为false,我们在开发过程中才会有具体报错原因
Vue.config.productionTip = false

效果如下 

import Vue from 'vue'
import App from './App.vue'

// 是否使用生产模式改为false,我们在开发过程中才会有具体报错原因
Vue.config.productionTip = false

new Vue({
  render: h => h(App),
}).$mount('#app')

我们写组件的时候,template有下划线提示,解决方式

 2.解决方法jsconfig.js文件中添加 

 "jsx": "preserve",

效果如下

{
  "compilerOptions": {
    "target": "es5",
    "module": "esnext",
    "baseUrl": "./",
    "jsx": "preserve",
    "moduleResolution": "node",
    "paths": {
      "@/*": [
        "src/*"
      ]
    },
    "lib": [
      "esnext",
      "dom",
      "dom.iterable",
      "scripthost"
    ]
  }
}

3.我们写组件的时候,会遇到提示组件名不规范的问题


 

报错提示

error  Component name "index" should always be multi-word  vue/multi-word-component-names

 只需要在vue.config.js中配置下就好了,这个是配置文件,配置好后,需要重启项目

const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
  transpileDependencies: true,
  lintOnSave:false
})

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值