adambullmer / vue-cli-plugin-browser-extension

Browser extension development plugin for vue-cli 3.0
GNU Lesser General Public License v3.0
427 stars 76 forks source link

How do I use Vue Router when injecting Vue into the webpage via content-scripts #102

Closed garthhumphreys closed 4 years ago

garthhumphreys commented 4 years ago

Hi I’ve been able to configure the content-script.js to inject Vue into a webpage (currently I’m not using an iframe to inject into, I just attach the Vue app to a div on the website).

However, when I click on any of the router links, they try to prepend the website’s domain and then navigate to a page on that site.

Instead I would like the Vue route to load a page/component.

I’m not 100% sure how to do that though :smile:

Thanks

garthhumphreys commented 4 years ago

Nvm I resolved the 'issue' I didn't fully understand the role of the router nor did I understand how it worked. In the end I implemented 'Dynamic Components'. I primarily followed this tutorial as a guide (https://reactgo.com/vue-tabs-tutorial/#/), however there's great documentation on the vuejs website too (https://vuejs.org/v2/guide/components.html#/Dynamic-Components).