Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (hostVm) {
// Whether replace host vm
if (options.mode === 'append') {
parentVm = hostVm;
} else {
var _parent = hostVm.$parent;
hostVm.$emit('mount:destroy');
hostVm.$destroy();
instance.$parent = _parent;
_parent && (_parent.$children = _toConsumableArray(new Set([].concat(_toConsumableArray(_parent.$children), [instance]))));
}
}
if (parentVm) {
parentVm.$children = _toConsumableArray(new Set([].concat(_toConsumableArray(parentVm.$children), [instance])));
instance.$parent = parentVm;
instance.$root = parentVm.$root;
}
if (options.mode === 'append') {
// Append mount
instance.$mount();
options.targetElement.appendChild(instance.$el);
} else {
// Replace Mount
instance.$mount(options.targetElement);
checkAndRmUnmountedVm(parentVm);
}
}
instance.$el.__mount__ = this; // Emit instance mount event
} // Append to vue component instance
else {
var hostVm = isVueInstance(options.targetElement),
parentVm = findParentVm(options.targetElement);
if (isRootVue(hostVm)) hostVm = hostVm.$children[0];
if (hostVm) {
// Whether replace host vm
if (options.mode === 'append') {
parentVm = hostVm;
} else {
var _parent = hostVm.$parent;
hostVm.$emit('mount:destroy');
hostVm.$destroy();
instance.$parent = _parent;
_parent && (_parent.$children = _toConsumableArray(new Set([].concat(_toConsumableArray(_parent.$children), [instance]))));
}
}
if (parentVm) {
parentVm.$children = _toConsumableArray(new Set([].concat(_toConsumableArray(parentVm.$children), [instance])));
instance.$parent = parentVm;
instance.$root = parentVm.$root;
}
if (options.mode === 'append') {
// Append mount
instance.$mount();
options.targetElement.appendChild(instance.$el);
} else {
// Replace Mount
instance.$mount(options.targetElement);
value: function mount(opt) {
var instance = this.component_instance = this.getInstance(opt);
var options = this.options; // Instance would not mount more than once
if (instance._isMounted) return instance; // Append to root vue instance
if (this._to_mount_root) {
if (!this._to_create_root) {
checkAndRmUnmountedVm(options.rootVm);
instance.$root = options.rootVm;
instance.$parent = options.rootVm;
options.rootVm.$children = _toConsumableArray(new Set([].concat(_toConsumableArray(options.rootVm.$children), [instance])));
instance.$mount();
options.rootEl.appendChild(instance.$el);
} else {// NOTE: instance has been mounted in method `getInstance`
}
} // Append to vue component instance
else {
var hostVm = isVueInstance(options.targetElement),
parentVm = findParentVm(options.targetElement);
if (isRootVue(hostVm)) hostVm = hostVm.$children[0];
if (hostVm) {
// Whether replace host vm
if (options.mode === 'append') {
parentVm = hostVm;
} else {
var _parent = hostVm.$parent;
var regexRoute = route.replace('*', '.*');
regexRoute = regexRoute.replace('//', '\\//');
var regex = new RegExp('^' + regexRoute + '$', 'i');
var currentRoute = this.$route.path !== '' ? this.$route.path : '/';
if (!isEmpty(this.$vuefront.params.url)) {
currentRoute = this.$vuefront.params.url;
}
currentRoute = currentRoute.replace('/amp', '');
currentRoute = currentRoute !== '' ? currentRoute : '/';
if (regex.test(currentRoute) && !isUndefined(layout[this.position])) {
for (var key in layout[this.position]) {
if (isString(layout[this.position][key])) {
result = [].concat(_toConsumableArray(result), [{
component: 'vfE' + layout[this.position][key],
props: {}
}]);
} else {
result = [].concat(_toConsumableArray(result), [{
component: 'vfE' + layout[this.position][key][0],
props: layout[this.position][key][1]
}]);
}
}
}
}
return result;
}
}
}, function (err, resp) {
if (err) {
reject(err);
}
var commentData = [].concat(_toConsumableArray(accumulator), _toConsumableArray(resp.data.files));
if (resp.data.nextPageToken) {
getChildren(fileId, resp.data.nextPageToken, commentData);
} else {
resolve(commentData);
}
});
};
}, function (err, resp) {
if (err) {
reject(err);
}
var commentData = [].concat(_toConsumableArray(accumulator), _toConsumableArray(resp.data.comments));
if (resp.data.nextPageToken) {
getComments(fileId, resp.data.nextPageToken, commentData);
} else {
resolve(commentData);
}
});
};
setEntities: function setEntities(state, pages) {
state.entities = [];
for (var key in pages.content) {
state.entities = [].concat(_toConsumableArray(state.entities), [{
title: pages.content[key].title,
to: pages.content[key].keyword !== "" ? "/".concat(pages.content[key].keyword) : "/common/page/".concat(pages.content[key].id)
}]);
}
}
};