Commit cd9d2d49 authored by jingnan's avatar jingnan 👀

合并产品【12034】弹框组织选择器数据回显时存在bug

parent ae02b6e6
......@@ -35,7 +35,6 @@ export default {
key: 'component.bindKey',
title: '绑定属性',
component: {
obscure: `this.form.component.bindType !== 'key'`,
defaultValue: 'id',
name: 'el-input'
}
......
......@@ -88,7 +88,7 @@ export default {
return
}
const ids = this.getIds(val)
this.getNodeDatByIdS(ids, this.initBindKey)
this.getNodeDatByIdS(ids, this.bindKey)
}
}
},
......@@ -218,12 +218,14 @@ export default {
return o && Object.prototype.toString.call(o) === '[object Object]'
},
/**
* 判断一个数据是 null, undefined, NAN, 空字符串 这些类型
* 判断一个数据是 null, undefined, NAN, 空字符串('')、空字对象({})、空数组([]) 这些类型
* @param {Any} o 要判断类型的数据
*/
isInvalidType(o) {
const type = typeof o
return type === 'undefined' || (type === 'string' && !o.trim().length) || isNaN(o) || (!o && Object.prototype.toString.call(o) === '[object Object]')
// type 的值:number、string、boolean、object、set、undefined、null
// 判断 NaN 要用 Number.isNaN(),他会不先做转数字操作,而 NaN() 会先做转数据操作
const type = Object.prototype.toString.call(o).replace(/^\[object\s+/, '').replace(/]$/, '').toLowerCase()
return [null, undefined].includes(o) || Number.isNaN(o) || (type === 'string' && !o.trim().length) || (type === 'object' && !Object.keys(o).length) || (Array.isArray(o) && !o.length)
},
// 取出绑定数据的id
getIds(val) {
......
......@@ -20,7 +20,7 @@ export default {
type: String,
default: 'String'
},
initBindKey: {
bindKey: {
type: String,
default: 'id'
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment