创建Vue项目指令: vue create name
默认app.vue为主题 main.js负责引入
在vue.config.js中关闭严格模式或创建时自己设置关闭
手动关闭指令lintOnSave:false
网络代理如
遇到/hj请求就由本地网址向target中的网址发起代理请求实现跨域
proxy:{
"/hj":{
target:"http://192.168.0.108:7001",
secure:true,
pathRewrite:{
"^/hj":"/"
},
}
}
}
组件的结构,方法与对象
三个组成部分
template script style
script中expor default{}内些组件的各种数据和业务
组件中的data写法 data(){return {msg,arr}}
import Box from "./XXX.vue"
组件注册模块:components:{
组件注册写法:外部引入了 就直接写Box,
懒加载写法:需要使用时才加载组件: Box:()=>import("XX.vue")
}
在export default { }中可以写各种业务 methods computed filters 和生命周期函数
注意点:
template中只能有一个根元素