debian-mirror-gitlab/app/assets/javascripts/nav/mount.js

29 lines
625 B
JavaScript
Raw Normal View History

2021-06-08 01:23:25 +05:30
import Vue from 'vue';
import Vuex from 'vuex';
2021-09-04 01:27:46 +05:30
import ResponsiveApp from './components/responsive_app.vue';
2021-06-08 01:23:25 +05:30
import App from './components/top_nav_app.vue';
import { createStore } from './stores';
Vue.use(Vuex);
2021-09-04 01:27:46 +05:30
const mount = (el, Component) => {
2021-06-08 01:23:25 +05:30
const viewModel = JSON.parse(el.dataset.viewModel);
const store = createStore();
return new Vue({
el,
store,
render(h) {
2021-09-04 01:27:46 +05:30
return h(Component, {
2021-06-08 01:23:25 +05:30
props: {
navData: viewModel,
},
});
},
});
};
2021-09-04 01:27:46 +05:30
export const mountTopNav = (el) => mount(el, App);
export const mountTopNavResponsive = (el) => mount(el, ResponsiveApp);