Skip to content

Commit e3da39c

Browse files
committed
perf:代码优化
1 parent 616d6bb commit e3da39c

File tree

16 files changed

+1387
-638
lines changed

16 files changed

+1387
-638
lines changed

package-lock.json

Lines changed: 907 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,17 @@
1111
"lint": "eslint --fix --ext .js,.vue src",
1212
"unit": "cross-env BABEL_ENV=test karma start karma.config.js --single-run"
1313
},
14+
"husky": {
15+
"hooks": {
16+
"pre-commit": "lint-staged"
17+
}
18+
},
19+
"lint-staged": {
20+
"src/**/*.{js,vue}": [
21+
"npm run lint",
22+
"git add"
23+
]
24+
},
1425
"dependencies": {
1526
"axios": "^0.19.2",
1627
"base64-js": "^1.3.1",
@@ -85,6 +96,7 @@
8596
"function-bind": "^1.1.1",
8697
"html-webpack-plugin": "^3.2.0",
8798
"http-proxy-middleware": "^0.17.4",
99+
"husky": "^4.3.6",
88100
"json-loader": "^0.5.7",
89101
"karma": "^5.0.5",
90102
"karma-chai": "^0.1.0",
@@ -94,6 +106,7 @@
94106
"karma-sourcemap-loader": "^0.3.7",
95107
"karma-spec-reporter": "0.0.32",
96108
"karma-webpack": "^4.0.2",
109+
"lint-staged": "^10.5.3",
97110
"mini-css-extract-plugin": "^0.9.0",
98111
"mocha": "^7.1.2",
99112
"mockjs": "^1.0.1-beta3",
@@ -129,4 +142,4 @@
129142
"last 2 versions",
130143
"not ie <= 8"
131144
]
132-
}
145+
}

src/api/modules/validatorApi.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import axios from '../axiosWrapper';
22

3-
let prefix = process.env.API_ROOT
3+
let prefix = process.env.API_ROOT;
44

55
//系统页面相关接口
66
export const getPageRulesList = params => {

src/components/AceEditor.vue

Lines changed: 0 additions & 121 deletions
This file was deleted.

src/components/myDialog.vue

Lines changed: 56 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
<!--
2+
* @Author: nigel
3+
* @Date: 2020-03-19 17:42:35
4+
* @LastEditTime: 2020-12-21 17:51:24
5+
-->
16
<!-- 自定义dialog -->
27
<template>
38
<el-dialog
@@ -19,73 +24,72 @@
1924
:value="item.label"
2025
/>
2126
</el-select>
22-
<span
23-
slot="footer"
24-
class="dialog-footer"
25-
>
27+
<span slot="footer" class="dialog-footer">
2628
<el-button @click="dialogVisibleChangeCancel">取 消</el-button>
27-
<el-button
28-
type="primary"
29-
@click="dialogVisibleChangeConfirm"
30-
>确 定</el-button>
29+
<el-button type="primary" @click="dialogVisibleChangeConfirm">确 定</el-button>
3130
</span>
3231
</el-dialog>
3332
</template>
3433

3534

3635
<style lang="sass" scoped>
37-
3836
</style>
3937

4038

4139
<script>
4240
export default {
43-
props:["dialogVisible","title","groupListData"],
44-
data() {
45-
return {
46-
options: [{
47-
value: '0',
48-
label: '全部'
49-
}, {
50-
value: '1',
51-
label: '标签1'
52-
}, {
53-
value: '2',
54-
label: '标签2'
55-
}, {
56-
value: '3',
57-
label: '标签3'
58-
}],
59-
value: []
60-
}
61-
},
62-
watch:{
63-
groupListData:function(val){
64-
this.value = [];
65-
var groupListData = val;
66-
for(let i=0;i<groupListData.length;i++){
67-
this.value.push(groupListData[i].label);
68-
}
69-
}
70-
},
71-
methods:{
72-
dialogVisibleChangeCancel(){
73-
this.$emit('dialogVisibleChange');
41+
props: ["dialogVisible", "title", "groupListData"],
42+
data() {
43+
return {
44+
options: [
45+
{
46+
value: "0",
47+
label: "全部",
48+
},
49+
{
50+
value: "1",
51+
label: "标签1",
7452
},
75-
dialogVisibleChangeConfirm(){
76-
this.$confirm('确认?').then(_ => {
77-
this.$emit('dialogVisibleChange');
78-
})
79-
.catch(_ => {});
53+
{
54+
value: "2",
55+
label: "标签2",
8056
},
81-
handleGroupList(){
82-
console.log(this.value);
57+
{
58+
value: "3",
59+
label: "标签3",
8360
},
84-
dialogClose(){
85-
this.$emit('dialogVisibleChange');
86-
}
87-
}
88-
}
61+
],
62+
value: [],
63+
};
64+
},
65+
watch: {
66+
groupListData: function (val) {
67+
this.value = [];
68+
var groupListData = val;
69+
for (let i = 0; i < groupListData.length; i++) {
70+
this.value.push(groupListData[i].label);
71+
}
72+
},
73+
},
74+
methods: {
75+
dialogVisibleChangeCancel() {
76+
this.$emit("dialogVisibleChange");
77+
},
78+
dialogVisibleChangeConfirm() {
79+
this.$confirm("确认?")
80+
.then(() => {
81+
this.$emit("dialogVisibleChange");
82+
})
83+
.catch(() => {});
84+
},
85+
handleGroupList() {
86+
console.log(this.value);
87+
},
88+
dialogClose() {
89+
this.$emit("dialogVisibleChange");
90+
},
91+
},
92+
};
8993
</script>
9094

9195

src/components/myToTop.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export default {
5555
return {
5656
isShow: false,
5757
target: ''
58-
}
58+
};
5959
},
6060
mounted () {
6161
this.target = document.querySelector(".content-container");
@@ -82,8 +82,8 @@ export default {
8282
clearInterval(timer);
8383
this.isShow = false;
8484
}
85-
}, 20)
85+
}, 20);
8686
}
8787
}
88-
}
88+
};
8989
</script>

0 commit comments

Comments
 (0)