Sign in to follow this  
State Valentin

It's possible to use Vue.js Router in CEF ?

Recommended Posts

A bit late, but someone else might need this. 🤔

In case you've just generated a new project via the vue-cli, you can go with this:

Change the publicPath in vue.config.js

module.exports = {
  publicPath: './',

Use hash-mode in router.js (this will append the route-path to your index.html with "#" before and you're able to call the index file directly without serving it first)

import Vue from 'vue'
import Router from 'vue-router'
import Home from './views/Home.vue'


export default new Router({
  mode: 'hash',
  base: process.env.BASE_URL,
  routes: [
      path: '/',
      name: 'home',
      component: Home
      path: '/about',
      name: 'about',
      component: () => import('./views/About.vue')

Call the index.html after you built your project via npm run build and put the dist-Directory wherever your CEF files should be.'package://<PATH_TO_YOUR_CEF_DIR>/dist/index.html');

I just went with the default vue-cli app here and it works fine.



Alternatively you just serve your vue app via http and call it, for example:'http://localhost:8080');


I like the index.html-ish solution more, because this way you have your CEF files neatly within your client_packages and nothing depends on another process running. 👍



Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.