<!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> <!-- 和webpack创建的工程区别,index.html放在了pubic的外面 --> <!-- Vite以index.html作为入口,不再使用main.js作为入口了 --> <!-- 对于vite构建工具来说,配置文件时vite.config.js --> <!-- 这个vite.config.js类似于webpack打包的vue.config.js --> <div id="app"></div> <script type="module" src="/src/main.js"></script> </body> </html>
<!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>
<!-- 和webpack创建的工程区别,index.html放在了pubic的外面 -->
<!-- Vite以index.html作为入口,不再使用main.js作为入口了 -->
<!-- 对于vite构建工具来说,配置文件时vite.config.js -->
<!-- 这个vite.config.js类似于webpack打包的vue.config.js -->
<div id="app"></div>
<script type="module" src="/src/main.js"></script>
</body>
</html>
<template> <HelloWorld></HelloWorld> </template> <script> import HelloWorld from './components/HelloWorld.vue'; export default { name : "App", components : {HelloWorld} } </script> <style> </style>
<template>
<HelloWorld></HelloWorld>
</template>
<script>
import HelloWorld from './components/HelloWorld.vue';
export default {
name : "App",
components : {HelloWorld}
}
</script>
<style>
</style>
import { createApp } from 'vue' import App from './App.vue' createApp(App).mount('#app')
import { createApp } from 'vue'
import App from './App.vue'
createApp(App).mount('#app')
<template> <h1>Hello World</h1> <h1>大家好</h1> </template> <script> export default { name : 'HelloWorld' } </script> <style> </style>
<template>
<h1>Hello World</h1>
<h1>大家好</h1>
</template>
<script>
export default {
name : 'HelloWorld'
}
</script>
<style>
</style>