![【vue】项目目录结构及使用多的知识点 【vue】项目目录结构及使用多的知识点](https://image.shishitao.com:8440/aHR0cHM6Ly9ia3FzaW1nLmlrYWZhbi5jb20vdXBsb2FkL2NoYXRncHQtcy5wbmc%2FIQ%3D%3D.png?!?w=700&webp=1)
项目目录:
Node_modules/npm安装的该项目的依赖库
vuex/文件夹存放的是和 Vuex store 相关的东西(state对象,actions,mutations)
router/文件夹存放的是跟vue-router相关的路由配置项
build/文件是 webpack 的打包编译配置文件
static/文件夹存放一些静态的、较少变动的image或者css文件
config/文件夹存放的是一些配置项,比如服务器访问的端口配置等
dist/该文件夹一开始是不存在,在我们的项目经过 build 之后才会产出
App.vue根组件,所有的子组件都将在这里被引用
index.html整个项目的入口文件,将会引用我们的根组件 App.vue
main.js入口文件的 js 逻辑,在webpack 打包之后将被注入到 index.html 中
项目中用法的知识点:
1.合并对象
相关链接:https://blog.****.net/qq_30100043/article/details/53422657
项目实战:接口参数是在定义的this.form基础上新增了几项
submitForm(formName) {
let _this = this,data = this.form,temp;
if(!data.corpid) {//添加
delete data.corpid;
temp = {
agentid:'0',
binding:'-1',
type:'0',
eid:this.$store.getters.eid,
}
} else {//编辑
temp = {
type:'0',
eid:this.$store.getters.eid,
}
} this.$refs[formName].validate((valid) => {
if (valid) {
if(!data.corpid) {//添加
AxiosOpenplatform.getCorpid(data).then(response =>{//获取corpid
if (response.data.status == 'Y') {
_this.form = response.data.data;
Object.assign(_this.form,temp);
_this.$_add(_this.form);
} else {
this.$message.error(response.data.msg);
}
});
}else{//编辑
Object.assign(_this.form,temp);
_this.$_update(_this.form);
} } else {
this.$message.error('请填写完整后提交');
return false;
}
});
},
2.es6中使用Number.isInteger()用来判断一个值是否为整数。