国产chinesehdxxxx野外,国产av无码专区亚洲av琪琪,播放男人添女人下边视频,成人国产精品一区二区免费看,chinese丰满人妻videos

數(shù)據(jù)綁定

2020-12-29 10:53 更新

數(shù)據(jù)綁定使用 Mustache 語法(同時(shí)支持雙大括號(hào)、單大括號(hào))將變量或表達(dá)式包起來,可以用于綁定文本內(nèi)容或元素屬性。

綁定文本

綁定文本使用 Mustache 語法,變量需要在data中定義。

<template>
    <text>{{msg}}</text>
</template>
<script>
    export default {
        name: 'test',
        data(){
            return {
                msg: 'hello'
            }
        }
    }
</script>

大括號(hào)里面的內(nèi)容也可以為表達(dá)式時(shí),如:

<text>{{'message: ' + this.data.msg}}</text>

綁定屬性

綁定屬性可以使用 Mustache 語法,也可以使用v-bind指令。

使用 Mustache 語法:

<text text={{msg}}></text>

使用v-bind指令:

<text v-bind:text="msg"></text>

計(jì)算屬性

數(shù)據(jù)綁定的變量也可以是計(jì)算屬性,如:

<template>
    <text v-bind:text="message"></text>
</template>
<script>
    export default {
        name: 'test',
        data(){
            return {
                msg: 'hello'
            }
        },
        computed:{
            message:function(){
                return 'message:' + this.data.msg;
            }
        }
    }
</script>
以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)