更新依赖,按照eslint-vue调整代码

This commit is contained in:
hooray
2020-10-27 14:30:44 +08:00
parent 0a0b1ba393
commit e11d05998f
15 changed files with 241 additions and 240 deletions
+1 -1
View File
@@ -18,7 +18,7 @@ export default {
},
watch: {
$route: 'routeChange',
'$store.state.keepAlive.list': val => {
'$store.state.keepAlive.list'(val) {
process.env.NODE_ENV == 'development' && console.log(`[ keepAliveList ] ${val}`)
}
},
+1 -1
View File
@@ -34,7 +34,7 @@ export default {
return flag
},
set: function(newVal) {
newVal ? this.$emit('checkAll') : this.$emit('checkNull')
newVal ? this.$emit('check-all') : this.$emit('check-null')
}
},
isIndeterminate() {
+5 -4
View File
@@ -58,22 +58,23 @@ export default {
},
// 将 code 码转成中文
set: function(value) {
const [pCode, cCode, aCode] = value
let [pCode, cCode, aCode] = value
area.map(p => {
if (p.code === pCode) {
this.value[0] = p.name
pCode = p.name
p.children.map(c => {
if (c.code === cCode) {
this.value[1] = c.name
cCode = c.name
c.children.map(a => {
if (a.code === aCode) {
this.value[2] = a.name
aCode = a.name
}
})
}
})
}
})
this.$emit('update:value', [pCode, cCode, aCode])
}
}
}
+1 -1
View File
@@ -81,7 +81,7 @@ export default {
this.$message.warning('文件上传超过限制')
},
onSuccess(res, file) {
this.$emit('onSuccess', res, file)
this.$emit('on-success', res, file)
}
}
}
+1 -1
View File
@@ -134,7 +134,7 @@ export default {
}
},
onSuccess(res) {
this.$emit('onSuccess', res)
this.$emit('on-success', res)
}
}
}
+17 -11
View File
@@ -45,15 +45,18 @@
<el-alert :title="`上传图片支持 ${ ext.join(' / ') } 格式,单张图片大小不超过 ${ size }MB,建议图片尺寸为 ${width}*${height},且图片数量不超过 ${ max } 张`" type="info" show-icon :closable="false" />
</div>
</div>
<el-dialog :visible.sync="dialogVisible" title="预览" width="800px">
<img :src="dialogImageUrl" style="display: block; max-width: 100%; margin: 0 auto;">
</el-dialog>
<el-image-viewer v-if="imageViewerVisible" :on-close="() => {imageViewerVisible = false}" :url-list="[dialogImageUrl]" />
</div>
</template>
<script>
import ElImageViewer from 'element-ui/packages/image/src/image-viewer'
export default {
name: 'ImagesUpload',
components: {
ElImageViewer
},
props: {
action: {
type: String,
@@ -107,7 +110,7 @@ export default {
data() {
return {
dialogImageUrl: '',
dialogVisible: false,
imageViewerVisible: false,
progress: {
preview: '',
percent: 0
@@ -118,21 +121,24 @@ export default {
// 预览
preview(index) {
this.dialogImageUrl = this.url[index]
this.dialogVisible = true
this.imageViewerVisible = true
},
// 移除
remove(index) {
this.url.splice(index, 1)
this.$emit('update:url', this.url)
let url = this.url
url.splice(index, 1)
this.$emit('update:url', url)
},
// 移动
move(index, type) {
let url = this.url
if (type == 'left' && index != 0) {
this.url[index] = this.url.splice(index - 1, 1, this.url[index])[0]
url[index] = url.splice(index - 1, 1, url[index])[0]
}
if (type == 'right' && index != this.url.length - 1) {
this.url[index] = this.url.splice(index + 1, 1, this.url[index])[0]
if (type == 'right' && index != url.length - 1) {
url[index] = url.splice(index + 1, 1, url[index])[0]
}
this.$emit('update:url', url)
},
beforeUpload(file) {
const fileName = file.name.split('.')
@@ -158,7 +164,7 @@ export default {
}
},
onSuccess(res) {
this.$emit('onSuccess', res)
this.$emit('on-success', res)
}
}
}
+1 -1
View File
@@ -6,7 +6,7 @@
<div class="tips">你可以使用快捷键<span>alt</span>+<span>s</span>唤醒搜索面板,按<span>esc</span>退出</div>
</div>
<div ref="search" class="result">
<router-link v-for="item in resultList" :key="item.path" v-slot="{ href, route, navigate }" :to="item.path">
<router-link v-for="item in resultList" :key="item.path" v-slot="{ href, navigate }" :to="item.path">
<a :href="isExternal(item.path) ? item.path : href" class="item" :target="isExternal(item.path) ? '_blank' : '_self'" @click="navigate">
<div class="icon">
<svg-icon :name="item.icon" />
+1 -1
View File
@@ -1,6 +1,6 @@
<template>
<div v-if="item.meta.sidebar !== false">
<router-link v-if="!hasChildren" v-slot="{ href, route, navigate, isActive, isExactActive }" :to="resolvePath(item.path)">
<router-link v-if="!hasChildren" v-slot="{ href, navigate, isActive, isExactActive }" :to="resolvePath(item.path)">
<a :href="isExternal(resolvePath(item.path)) ? resolvePath(item.path) : href" :class="[isActive && 'router-link-active', isExactActive && 'router-link-exact-active']" :target="isExternal(resolvePath(item.path)) ? '_blank' : '_self'" @click="navigate">
<el-menu-item :title="item.meta.title" :index="resolvePath(item.path)">
<svg-icon v-if="item.meta.icon" :name="item.meta.icon" />
+1 -1
View File
@@ -41,8 +41,8 @@
import screenfull from 'screenfull'
export default {
inject: ['reload'],
name: 'UserMenu',
inject: ['reload'],
data() {
return {
isFullscreenEnable: screenfull.isEnabled,
+1 -1
View File
@@ -106,8 +106,8 @@
import variables from '@/assets/styles/resources/variables.scss'
export default {
inject: ['reload'],
name: 'Layout',
inject: ['reload'],
data() {
return {
routePath: '',
+1 -1
View File
@@ -9,8 +9,8 @@
<script>
export default {
inject: ['reload'],
name: 'ComponentExampleArea',
inject: ['reload'],
props: {},
data() {
return {
+7 -7
View File
@@ -20,13 +20,6 @@
<script>
export default {
name: 'KeepAliveExamplePage',
props: {},
data() {
return {
openKeepAlive: false,
num: 1
}
},
beforeRouteEnter(to, from, next) {
// 进入页面时,先将当前页面的 name 信息存入 keep-alive 全局状态
next(vm => {
@@ -46,6 +39,13 @@ export default {
}
next()
},
props: {},
data() {
return {
openKeepAlive: false,
num: 1
}
},
created() {},
mounted() {},
methods: {
+6 -6
View File
@@ -70,6 +70,12 @@
<script>
export default {
name: 'PersonalSetting',
beforeRouteLeave(to, from, next) {
if (['personalEditPassword'].includes(to.name)) {
this.$store.commit('keepAlive/add', 'PersonalSetting')
}
next()
},
props: {},
data() {
return {
@@ -97,12 +103,6 @@ export default {
name: 'personalEditPassword'
})
}
},
beforeRouteLeave(to, from, next) {
if (['personalEditPassword'].includes(to.name)) {
this.$store.commit('keepAlive/add', 'PersonalSetting')
}
next()
}
}
</script>