update property.js

This commit is contained in:
Harvey Zack committed 2023-04-22 15:03:48 +08:00
1 parent a3b767f15d
commit d34a6ba268
5 files changed
+14 -5

No files matched your search

+5
View File
@@ -33,6 +33,11 @@ export default class Artplayer extends Emitter {
this.id = ++id;
const mergeOption = utils.mergeDeep(Artplayer.option, option);
if (option.container instanceof Element) {
mergeOption.container = option.container;
}
this.option = validator(mergeOption, scheme);
this.isLock = false;
+3 -1
View File
@@ -10,6 +10,7 @@ import {
addClass,
setStyle,
isMobile,
mergeDeep,
inverseClass,
createElement,
includeFromEvent,
@@ -98,7 +99,8 @@ export default class Setting extends Component {
this.remove();
this.events = [];
this.cache = new Map();
const mergeSettings = [...this.defaultSettings, ...settings];
const settingsCopy = settings.map((item) => mergeDeep({}, item));
const mergeSettings = [...this.defaultSettings, ...settingsCopy];
this.option = Setting.makeRecursion(mergeSettings);
this.render(this.option);
return this.option;
+1 -1
View File
@@ -17,7 +17,7 @@ export function mergeDeep(...objects) {
const oVal = obj[key];
if (Array.isArray(pVal) && Array.isArray(oVal)) {
prev[key] = pVal.concat(...oVal);
} else if (isObject(pVal) && isObject(oVal) && !(oVal instanceof Element)) {
} else if (isObject(pVal) && isObject(oVal)) {
prev[key] = mergeDeep(pVal, oVal);
} else {
prev[key] = oVal;