Commit d1e5923f authored by Mike Greiling's avatar Mike Greiling

Load dynamic chunk only when dropdown is open

parent 6a949cd4
...@@ -28,16 +28,11 @@ export default function initFrequentItemDropdowns() { ...@@ -28,16 +28,11 @@ export default function initFrequentItemDropdowns() {
return; return;
} }
$(navEl).on('shown.bs.dropdown', () => { $(navEl).on('shown.bs.dropdown', () =>
eventHub.$emit(`${namespace}-dropdownOpen`); import('./components/app.vue').then(({ default: FrequentItems }) => {
});
// eslint-disable-next-line no-new // eslint-disable-next-line no-new
new Vue({ new Vue({
el, el,
components: {
FrequentItems: () => import('./components/app.vue'),
},
data() { data() {
const { dataset } = this.$options.el; const { dataset } = this.$options.el;
const item = { const item = {
...@@ -55,7 +50,7 @@ export default function initFrequentItemDropdowns() { ...@@ -55,7 +50,7 @@ export default function initFrequentItemDropdowns() {
}; };
}, },
render(createElement) { render(createElement) {
return createElement('frequent-items', { return createElement(FrequentItems, {
props: { props: {
namespace, namespace,
currentUserName: this.currentUserName, currentUserName: this.currentUserName,
...@@ -64,5 +59,9 @@ export default function initFrequentItemDropdowns() { ...@@ -64,5 +59,9 @@ export default function initFrequentItemDropdowns() {
}); });
}, },
}); });
eventHub.$emit(`${namespace}-dropdownOpen`);
}),
);
}); });
} }
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