Vue3 directory structure
In the previous chapter, we used npm
for the installation project (Vue-cli and Vite), we open the directory in IDE (Vscode, Atom, etc.) with the following structure:
Command line tool vue-cli (runoob-vue3-test):
Vite(runoob-vue3-test2)
Directory parsing
Next, take runoob-vue3-test2 as an example, open the src/APP.vue
file, the code is as follows (explained in comments):
src/APP.vue
file code
<!-- Display template -->
<template>
<img alt="Vue logo" src="./assets/logo.png" />
<HelloWorld msg="Hello Vue 3.0 + Vite" />
</template>
<!-- Vue code -->
<script>
/\* Introducing HelloWorld components from src/components/HelloWorld.vue \*/
import HelloWorld from './components/HelloWorld.vue'
export default {
name: 'App',
components: {
HelloWorld
}
}
</script>
Next, we can try to modify the initialized project by changing src/APP.vue
to the following code:
src/APP.vue
file code
<template>
<img alt="Vue logo" src="./assets/logo.png" />
<HelloWorld msg="Welcome to the Rookie Tutorial!" />
</template>
<script>
import HelloWorld from './components/HelloWorld.vue'
export default {
name: 'App',
components: {
HelloWorld
}
}
</script>
Open the page http://localhost:3000/, which is automatically refreshed aftermodification, and the display effect is as follows: