深圳全飞鸿
标题:
Vue一个空项目的目录结构和内容
[打印本页]
作者:
syant
时间:
2024-7-27 19:42
标题:
Vue一个空项目的目录结构和内容
App.vue
<template>
<div id="app">
<img alt="Vue logo" src="./assets/logo.png">
<HelloWorld msg="Welcome to Your Vue.js App"/>
</div>
</template>
<script>
import HelloWorld from './components/HelloWorld.vue'
export default {
name: 'App',
components: {
HelloWorld
}
}
</script>
<style>
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
}
</style>
复制代码
作者:
syant
时间:
2024-7-27 19:43
main.js
import Vue from 'vue'
import App from './App.vue'
Vue.config.productionTip = false
//h是createElement的别名
new Vue({
render: h => h(App),
}).$mount('#app')
复制代码
作者:
syant
时间:
2024-7-27 19:44
components/HelloWorld.vue
<template>
<div class="hello">
<h1>{{ msg }}</h1>
</div>
</template>
<script>
export default {
name: 'HelloWorld',
props: {
msg: String
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h1 {
margin: 40px 0 0;
}
</style>
复制代码
作者:
syant
时间:
2024-7-27 20:16
① 内容渲染指令 v-text="message"、{{ message }}、v-html="message"
② 属性绑定指令 v-bind:value="message" 简写用冒号:value="message"
③ 事件绑定属性 v-on:click 简写用@click
④ 双向绑定指令 v-model="message"
⑤ 条件渲染指令 v-if="true"移除元素 v-show="false"修改display:none
⑥ 列表渲染指令 v-for="(item,index) in list"
作者:
syant
时间:
2024-7-27 20:16
① 内容渲染指令 v-text="message"、{{ message }}、v-html="message"
② 属性绑定指令 v-bind:value="message" 简写用冒号:value="message"
③ 事件绑定属性 v-on:click 简写用@click
④ 双向绑定指令 v-model="message"
⑤ 条件渲染指令 v-if="true"移除元素 v-show="false"修改display:none
⑥ 列表渲染指令 v-for="(item,index) in list"
欢迎光临 深圳全飞鸿 (http://www.nagomes.com/disc/)
Powered by Discuz! X3.2