mirror of https://github.com/halo-dev/halo-admin
Refactor code.
parent
b926977b12
commit
3a0258ff1f
|
@ -159,7 +159,6 @@ export default {
|
|||
components: { MenuSelectTree },
|
||||
data() {
|
||||
return {
|
||||
title: '添加菜单',
|
||||
formType: 'create',
|
||||
loading: false,
|
||||
columns,
|
||||
|
@ -168,6 +167,14 @@ export default {
|
|||
fieldExpand: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
title() {
|
||||
if (this.menuToCreate.id) {
|
||||
return '修改菜单'
|
||||
}
|
||||
return '添加菜单'
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.loadMenus()
|
||||
},
|
||||
|
@ -183,14 +190,12 @@ export default {
|
|||
this.createOrUpdateMenu()
|
||||
},
|
||||
handleAddMenu() {
|
||||
this.title = '添加菜单'
|
||||
this.formType = 'create'
|
||||
this.menuToCreate = {}
|
||||
},
|
||||
handleEditMenu(id) {
|
||||
menuApi.get(id).then(response => {
|
||||
this.menuToCreate = response.data.data
|
||||
this.title = '编辑菜单'
|
||||
this.formType = 'update'
|
||||
})
|
||||
},
|
||||
|
|
|
@ -146,7 +146,6 @@ export default {
|
|||
components: { CategorySelectTree, CategoryTree },
|
||||
data() {
|
||||
return {
|
||||
title: '添加分类',
|
||||
formType: 'create',
|
||||
categories: [],
|
||||
categoryToCreate: {},
|
||||
|
@ -154,6 +153,14 @@ export default {
|
|||
columns
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
title() {
|
||||
if (this.categoryToCreate.id) {
|
||||
return '修改分类'
|
||||
}
|
||||
return '添加分类'
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.loadCategories()
|
||||
},
|
||||
|
@ -169,14 +176,12 @@ export default {
|
|||
this.createOrUpdateCategory()
|
||||
},
|
||||
handleAddCategory() {
|
||||
this.title = '添加分类'
|
||||
this.formType = 'create'
|
||||
this.categoryToCreate = {}
|
||||
},
|
||||
handleEditCategory(id) {
|
||||
categoryApi.get(id).then(response => {
|
||||
this.categoryToCreate = response.data.data
|
||||
this.title = '编辑分类'
|
||||
this.formType = 'update'
|
||||
})
|
||||
},
|
||||
|
|
|
@ -138,7 +138,6 @@ const columns = [
|
|||
export default {
|
||||
data() {
|
||||
return {
|
||||
title: '添加友情链接',
|
||||
formType: 'create',
|
||||
data: [],
|
||||
loading: false,
|
||||
|
@ -147,6 +146,14 @@ export default {
|
|||
link: {}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
title() {
|
||||
if (this.link.id) {
|
||||
return '修改友情链接'
|
||||
}
|
||||
return '添加友情链接'
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.loadLinks()
|
||||
},
|
||||
|
@ -162,14 +169,12 @@ export default {
|
|||
this.createOrUpdateLink()
|
||||
},
|
||||
handleAddLink() {
|
||||
this.title = '添加友情链接'
|
||||
this.formType = 'create'
|
||||
this.link = {}
|
||||
},
|
||||
handleEditLink(id) {
|
||||
linkApi.get(id).then(response => {
|
||||
this.link = response.data.data
|
||||
this.title = '编辑友情链接'
|
||||
this.formType = 'update'
|
||||
})
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue