Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vue.js/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vue.js 带子路由的Electron vue新窗口_Vue.js_Electron_Router - Fatal编程技术网

Vue.js 带子路由的Electron vue新窗口

Vue.js 带子路由的Electron vue新窗口,vue.js,electron,router,Vue.js,Electron,Router,在electron vue中,我假设为每个新窗口创建新的vue实例。在我想将路由器子组件加载到“刷新”窗口之前,这一切都很正常。例如,我有一个条目 add: path.join(__dirname, '../src/renderer/pages/add.js'), 然后在pages/add.js中,我将使用以下路由器创建新的vue实例: routes: [ { path: '/', name: 'add', component: requ

在electron vue中,我假设为每个新窗口创建新的vue实例。在我想将路由器子组件加载到“刷新”窗口之前,这一切都很正常。例如,我有一个条目

add: path.join(__dirname, '../src/renderer/pages/add.js'),
然后在pages/add.js中,我将使用以下路由器创建新的vue实例:

routes: [
    {
        path: '/',
        name: 'add',
        component: require('@/components/add/add').default,
        beforeEnter: (to, from, next) => guard(to, from, next),
        children: [
            {
                path: 'exp',
                component: require('@/components/add/exp').default,
                beforeEnter: (to, from, next) => guard(to, from, next)
            },
如果我只想加载
/
,它可以正常工作,但我的add.vue组件是

<template>
    <router-view></router-view>
</template>

这个路径
文件://${uuuu dirname}/add.html/#/exp
不正确,因为我看到的是空白窗口。我还尝试了
file://${{uu dirname}/add.html/exp
file://${uu dirname}/add.html/{35;/exp
它们似乎都不起作用。

作为一个临时解决方案,我只是将路径更改为
file://${uu dirname}/add.html/exp?opt=exp
并基于add.vue创建的hook中的
window.location.search
,我正在通过
router.push({path:'exp'})推送路由

createAddExpPlaceWindow() {
    const winUrl = process.env.NODE_ENV === 'development'
        ? `http://localhost:9080/#/add/exp`
        : `file://${__dirname}/add.html/!#/exp`;