How to create and mount shadow element using Vue2?

Viewed 86

I am creating extension for chrome, using VUE2, i have a problem to creating and mounting shadow element, this is what my main.js file looks like, i want to create shadow element with id templates and also give it some css class, but when i check templates element is not created? any solution?

import Vue from 'vue'
import App from './App.vue'
import VueRouter from "vue-router"
import CKEditor from '@ckeditor/ckeditor5-vue2';
import router from "./router/router"

Vue.use(VueRouter)
Vue.use(router)
Vue.use(CKEditor)

const shadowElement = document.createElement('div');
shadowElement.setAttribute("id", "templates");
shadowElement.style.display = "hidden";
// shadowElement.attachShadow({ mode: 'open' });
document.body.appendChild(shadowElement);


new Vue({
    router,
    render: h => h(App),
  }).$mount('#templates')

0 Answers
Related