Skip to content

Commit 383b213

Browse files
committed
refine
1 parent 02097c0 commit 383b213

File tree

7 files changed

+60
-43
lines changed

7 files changed

+60
-43
lines changed

src/api/remoteSearch.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import request from '@/utils/request'
22

3-
export function userSearch(name) {
3+
export function searchUser(name) {
44
return request({
55
url: '/search/user',
66
method: 'get',

src/components/BackToTop/index.vue

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -88,29 +88,29 @@ export default {
8888
</script>
8989

9090
<style scoped>
91-
.back-to-ceiling {
92-
position: fixed;
93-
display: inline-block;
94-
text-align: center;
95-
cursor: pointer;
96-
}
91+
.back-to-ceiling {
92+
position: fixed;
93+
display: inline-block;
94+
text-align: center;
95+
cursor: pointer;
96+
}
9797
98-
.back-to-ceiling:hover {
99-
background: #d5dbe7;
100-
}
98+
.back-to-ceiling:hover {
99+
background: #d5dbe7;
100+
}
101101
102-
.fade-enter-active,
103-
.fade-leave-active {
104-
transition: opacity .5s;
105-
}
102+
.fade-enter-active,
103+
.fade-leave-active {
104+
transition: opacity .5s;
105+
}
106106
107-
.fade-enter,
108-
.fade-leave-to {
109-
opacity: 0
110-
}
107+
.fade-enter,
108+
.fade-leave-to {
109+
opacity: 0
110+
}
111111
112-
.back-to-ceiling .Icon {
113-
fill: #9aaabf;
114-
background: none;
115-
}
112+
.back-to-ceiling .Icon {
113+
fill: #9aaabf;
114+
background: none;
115+
}
116116
</style>

src/components/Breadcrumb/index.vue

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,15 @@ export default {
5959
</script>
6060

6161
<style lang="scss" scoped>
62-
.app-breadcrumb.el-breadcrumb {
63-
display: inline-block;
64-
font-size: 14px;
65-
line-height: 50px;
66-
margin-left: 8px;
67-
.no-redirect {
68-
color: #97a8be;
69-
cursor: text;
70-
}
62+
.app-breadcrumb.el-breadcrumb {
63+
display: inline-block;
64+
font-size: 14px;
65+
line-height: 50px;
66+
margin-left: 8px;
67+
68+
.no-redirect {
69+
color: #97a8be;
70+
cursor: text;
7171
}
72+
}
7273
</style>

src/components/Screenfull/index.vue

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ export default {
1717
mounted() {
1818
this.init()
1919
},
20+
beforeDestroy() {
21+
this.destroy()
22+
},
2023
methods: {
2124
click() {
2225
if (!screenfull.enabled) {
@@ -28,11 +31,17 @@ export default {
2831
}
2932
screenfull.toggle()
3033
},
34+
change() {
35+
this.isFullscreen = screenfull.isFullscreen
36+
},
3137
init() {
3238
if (screenfull.enabled) {
33-
screenfull.on('change', () => {
34-
this.isFullscreen = screenfull.isFullscreen
35-
})
39+
screenfull.on('change', this.change)
40+
}
41+
},
42+
destroy() {
43+
if (screenfull.enabled) {
44+
screenfull.off('change', this.change)
3645
}
3746
}
3847
}

src/layout/mixin/ResizeHandler.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ export default {
1414
beforeMount() {
1515
window.addEventListener('resize', this.resizeHandler)
1616
},
17+
beforeDestroy() {
18+
window.removeEventListener('resize', this.resizeHandler)
19+
},
1720
mounted() {
1821
const isMobile = this.isMobile()
1922
if (isMobile) {

src/views/example/components/ArticleDetail.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ import MDinput from '@/components/MDinput'
8181
import Sticky from '@/components/Sticky' // 粘性header组件
8282
import { validURL } from '@/utils/validate'
8383
import { fetchArticle } from '@/api/article'
84-
import { userSearch } from '@/api/remoteSearch'
84+
import { searchUser } from '@/api/remoteSearch'
8585
import Warning from './Warning'
8686
import { CommentDropdown, PlatformDropdown, SourceUrlDropdown } from './Dropdown'
8787
@@ -225,7 +225,7 @@ export default {
225225
this.postForm.status = 'draft'
226226
},
227227
getRemoteUserList(query) {
228-
userSearch(query).then(response => {
228+
searchUser(query).then(response => {
229229
if (!response.data.items) return
230230
this.userListOptions = response.data.items.map(v => v.name)
231231
})

vue.config.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ module.exports = {
3131
errors: true
3232
},
3333
proxy: {
34-
// Detail: https://cli.vuejs.org/config/#devserver-proxy
35-
// xxx-api/login => mock/login
34+
// change xxx-api/login => mock/login
35+
// detail: https://cli.vuejs.org/config/#devserver-proxy
3636
[process.env.VUE_APP_BASE_API]: {
3737
target: `http://localhost:${port}/mock`,
3838
changeOrigin: true,
@@ -71,6 +71,8 @@ module.exports = {
7171
chainWebpack(config) {
7272
config.plugins.delete('preload') // TODO: need test
7373
config.plugins.delete('prefetch') // TODO: need test
74+
75+
// set svg-sprite-loader
7476
config.module
7577
.rule('svg')
7678
.exclude.add(resolve('src/icons'))
@@ -86,6 +88,8 @@ module.exports = {
8688
symbolId: 'icon-[name]'
8789
})
8890
.end()
91+
92+
// set preserveWhitespace
8993
config.module
9094
.rule('vue')
9195
.use('vue-loader')
@@ -120,17 +124,17 @@ module.exports = {
120124
name: 'chunk-libs',
121125
test: /[\\/]node_modules[\\/]/,
122126
priority: 10,
123-
chunks: 'initial' // 只打包初始时依赖的第三方
127+
chunks: 'initial' // only package third parties that are initially dependent
124128
},
125129
elementUI: {
126-
name: 'chunk-elementUI', // 单独将 elementUI 拆包
127-
priority: 20, // 权重要大于 libs app 不然会被打包进 libs 或者 app
130+
name: 'chunk-elementUI', // split elementUI into a single package
131+
priority: 20, // the weight needs to be larger than libs and app or it will be packaged into libs or app
128132
test: /[\\/]node_modules[\\/]element-ui[\\/]/
129133
},
130134
commons: {
131135
name: 'chunk-commons',
132-
test: resolve('src/components'), // 可自定义拓展你的规则
133-
minChunks: 3, // 最小公用次数
136+
test: resolve('src/components'), // can customize your rules
137+
minChunks: 3, // minimum common number
134138
priority: 5,
135139
reuseExistingChunk: true
136140
}

0 commit comments

Comments
 (0)