V
V
volucris12021-03-28 10:02:06
Vue.js
volucris1, 2021-03-28 10:02:06

Why does everything after .mount disappear in Vue?

//main.js
import { createApp, ref } from 'vue'
const app = createApp({
    setup() {
        const someValue = ref(10);
        return {someValue}
    }
})

app.mount('#counter')

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8" />
    <link rel="icon" href="/favicon.ico" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Vite App</title>
</head>
<body>
asdas
    <div id="counter">
        Counter: {{ someValue }}
    </div>
    <script type="module" src="/src/main.js"></script>
</body>
</html>


Everything inside counter disappears

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question