zj-element
Version:
基于ElementUI的VUE组件——Жидзин(Zidjin)系列组件库。
39 lines (33 loc) • 1.16 kB
JavaScript
/** x-request-config V1.0 xxx 20230215 by Sieyoo, 赵向明 */
const XCurrentSelect = {};
/**
* function
* @param {object} options
* @param {object} value
* @param {object} config
* @desc 符号定义
* @return {Promise} 请求接口的返回信息
* @example 例子:
*/
XCurrentSelect.get = function(options, value, config={}){
// console.log("XCurrentSelect1:", options);
// console.log("XCurrentSelect2:", value);
// console.log("XCurrentSelect3:", config);
if(value instanceof Array) {
// value = value.toString();
// value = Number(value)
}
// console.log("value", value)
if(!options || !options.length)
return;
let current = options.find(it => {
// if(it.children) {
// this.XCurrentSelect.get(it.children, value, config={})()
// }
return it[config ? config.value : 'value'] === value;
})
// console.log("XCurrentSelect 22:", options);
// console.log("XCurrentSelect 2:", current);
return (current && current[config ? config.label : 'label' ]) || value;
}
export default XCurrentSelect;