Hi I tried pasting the installation script everywhere possible in my Vue project. In a normal HTML file it worked without a problem. But It’s hard for me to paste installation scripts inside vue. Somehow it get’S removed from the index.html I think
Vue3 will only replace the contents of the <div>
that you designate by ID in the .mount()
call.
For me, the main file (TypeScript) looks like (some sections removes):
import { createApp } from "vue";
import App from "./App.vue";
import router from "./router";
...
createApp(App)
.use(router)
...
.mount("#app");
and the index.html like:
<html lang="en">
<head>
<meta charset="utf-8" />
...
</head>
<body>
<noscript>
<strong
>We're sorry but this site doesn't work
properly without JavaScript enabled. Please enable it to
continue.</strong
>
</noscript>
<div id="app"></div>
<div id="some-other-id-of-div-to-retain"></div>
<script
async
src="https://cdn.snipcart.com/themes/v3.3.3/default/snipcart.js"
></script>
<div
hidden
id="snipcart"
data-api-key="{snipcart key goes here}"
></div>
</body>
</html>