YuraDev / vue-chrome-extension-template

vue chrome extension template
MIT License
651 stars 104 forks source link

How to generate Vue in content.js? #10

Open yzqiang opened 6 years ago

yzqiang commented 6 years ago

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?

YuraDev commented 6 years ago

Yes

michael-dm commented 6 years ago

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

altinselimi commented 6 years ago

@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)
    });