【fix ESLint】src/components/jero/JCategorySelect

This commit is contained in:
zhaoxiao
2023-03-03 16:35:09 +08:00
parent d84f974aba
commit 650a61685a
2 changed files with 10 additions and 12 deletions
+2 -1
View File
@@ -15,6 +15,7 @@ module.exports = {
'avoidEscape': true, 'avoidEscape': true,
'allowTemplateLiterals': true 'allowTemplateLiterals': true
}], }],
'semi': [2, 'never'] 'semi': [2, 'never'],
'prefer-promise-reject-errors': 'warn'
} }
} }
@@ -81,13 +81,10 @@ export default {
}, },
computed: { computed: {
_attrs () { _attrs () {
let attrs return { ...this.$attrs }
attrs = { ...this.$attrs }
return attrs
}, },
// 透传给下级组件的事件,需要排除本组件使用的change事件 // 透传给下级组件的事件,需要排除本组件使用的change事件
childListeners () { childListeners () {
const vm = this
const result = Object.assign({}, const result = Object.assign({},
this.$listeners this.$listeners
) )
@@ -121,9 +118,9 @@ export default {
if (res.success && res.result) { if (res.success && res.result) {
for (const i of res.result) { for (const i of res.result) {
i.value = i.key i.value = i.key
if (i.leaf == false) { if (i.leaf === false) {
i.isLeaf = false i.isLeaf = false
} else if (i.leaf == true) { } else if (i.leaf === true) {
i.isLeaf = true i.isLeaf = true
} }
} }
@@ -136,7 +133,7 @@ export default {
/** 数据回显 */ /** 数据回显 */
loadItemByCode () { loadItemByCode () {
if (!this.value || this.value == '0') { if (!this.value || this.value === '0') {
this.treeValue = [] this.treeValue = []
} else { } else {
getAction(this.view, { ids: this.value }).then(res => { getAction(this.view, { ids: this.value }).then(res => {
@@ -185,9 +182,9 @@ export default {
if (res.success) { if (res.success) {
for (const i of res.result) { for (const i of res.result) {
i.value = i.key i.value = i.key
if (i.leaf == false) { if (i.leaf === false) {
i.isLeaf = false i.isLeaf = false
} else if (i.leaf == true) { } else if (i.leaf === true) {
i.isLeaf = true i.isLeaf = true
} }
} }
@@ -201,8 +198,8 @@ export default {
addChildren (pid, children, treeArray) { addChildren (pid, children, treeArray) {
if (treeArray && treeArray.length > 0) { if (treeArray && treeArray.length > 0) {
for (const item of treeArray) { for (const item of treeArray) {
if (item.key == pid) { if (item.key + '' === pid + '') {
if (!children || children.length == 0) { if (!children || children.length === 0) {
item.isLeaf = true item.isLeaf = true
} else { } else {
item.children = children item.children = children