新增:菜单组件增加国际化语言支持;

This commit is contained in:
iczer
2020-06-23 14:22:11 +08:00
parent 68249a0458
commit b16b5893c8
17 changed files with 267 additions and 165 deletions

24
src/utils/Objects.js Normal file
View File

@@ -0,0 +1,24 @@
/**
* 给对象注入属性
* @param keys 属性key数组 如 keys = ['config', 'path'] , 则会给对象注入 object.config.path 的属性
* @param value 属性值
* @returns {Object}
*/
Object.defineProperty(Object.prototype, 'assignProps', {
writable: false,
enumerable: false,
configurable: true,
value: function (keys, value) {
let props = this
for (let i = 0; i < keys.length; i++) {
let key = keys[i]
if (i == keys.length - 1) {
props[key] = value
} else {
props[key] = props[key] == undefined ? {} : props[key]
props = props[key]
}
}
return this
}
})