import { createApp } from 'vue'; import App from './App.vue'; import { setupPageRunner } from './pageRunner'; /** * 将内容脚本应用挂载到页面中。 */ function mountApp() { if (document.getElementById('dianshan-crx-root')) { return; } const container = document.createElement('div'); container.id = 'dianshan-crx-root'; const appRoot = document.createElement('div'); container.appendChild(appRoot); document.body.appendChild(container); createApp(App).mount(appRoot); setupPageRunner(); } if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', mountApp, { once: true }); } else { mountApp(); }