vaide
Version:
A programming aid
38 lines (32 loc) • 943 B
JavaScript
/*
* @Description:
* @LastEditors: Please set LastEditors
* @Date: 2021-01-28 23:29:19
*/
import Vaide from '../packages/vaide/src/index';
import imgPreview from '../packages/imgPriview/src/main.vue'
import create from '../tools/create'
const components = [imgPreview];
const install = function (Vue,router,config) {
components.forEach(component => {
Vue.component(component.name,component);
});
if (router && (config && config.tools)) {
create(Vaide)
router && router.resolveHooks && router.resolveHooks.push((to,from,next) => {
let route = {}
to.matched.forEach(item => {
route[item.path || '/'] = item.components.default.__file
})
router && window.sessionStorage.setItem('route',JSON.stringify(route))
next()
})
}
};
if (typeof window !== 'undefined' && window.Vue) {
install(window.Vue);
}
export default {
install,
Vaide
};