1.如果需要直接插入文本值,则需要用{{}}
括起来
<template>
<div class="p1">
<p>{{name}}{{msg}}</p>
</div>
</template>
<script>
export default {
name: "hello01",
data(){
return{
name:"静静",
msg:"今天开始学习vue啦"
}
}
}
</script>
<style scoped>
</style>
2.v-bind
绑定属性,
注意简写模式
<template>
<div class="p1">
<p>{{name}}{{msg}}</p>
<!-- 绑定属性title-->
<span v-bind:title="que">你还好吗</span>
<br/>
<!-- v-bind的简写模式-->
<span :title="res">我很好</span>
</div>
</template>
<script>
export default {
name: "hello01",
data(){
return{
name:"静静",
msg:"今天开始学习vue啦",
que:"问题?",
res: "我很好!"
}
}
}
</script>
<style scoped>