vue-chrome-extension-template icon indicating copy to clipboard operation
vue-chrome-extension-template copied to clipboard

How to generate Vue in content.js?

Open yzqiang opened this issue 6 years ago • 3 comments

I want to generate from a Vue file in content.js and put the contents into the current tab, not in the popup or options html? Is it possible?

yzqiang avatar Mar 12 '18 05:03 yzqiang

Yes

YuraDev avatar Mar 15 '18 12:03 YuraDev

Hello ! Could you provide details on how to achieve this ? Thanks ! :)

michael-dm avatar Apr 17 '18 12:04 michael-dm

@yzqiang @midm Here you go:

    import Vue from 'vue';
    Vue.config.productionTip = false
    import component from './component.vue';

    var my_element = document.createElement('div')
    my_element.setAttribute('id', 'custom-plugin-identifier');
    document.body.appendChild(my_element);
    new Vue({
	el: '#custom-plugin-identifier',
	store,
	render: h => h(component)
    });

altinselimi avatar May 14 '18 11:05 altinselimi