久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      vue使用什么綁定數(shù)據(jù)

      vue綁定數(shù)據(jù)的方法:1、用雙大括號“{{}}”把數(shù)據(jù)給到頁面;2、使用vue指令,v-bind指令可實(shí)現(xiàn)單向數(shù)據(jù)綁定,v-model指令可實(shí)現(xiàn)雙向數(shù)據(jù)綁定;3、使用“:”,只需在標(biāo)簽屬性前加“:”進(jìn)行綁定即可;4、使用“${}”,只需在數(shù)據(jù)前拼接字符串用“${}”。

      vue使用什么綁定數(shù)據(jù)

      本教程操作環(huán)境:windows7系統(tǒng)、vue3版,DELL G3電腦。

      Vue綁定數(shù)據(jù)的幾種方式

      一、用雙大括號 ‘{{}}’ 把數(shù)據(jù)給到頁面

      <template>    <div class="mainBody">       <h3>{{ msg }}</h3>   </div></template><script>export default {    data(){      return{        msg:'月落烏啼霜滿天',      }}}</script>
      登錄后復(fù)制

      vue使用什么綁定數(shù)據(jù)

      二、使用vue指令

      <template>    <div class="mainBody">        <Input v-model="msg"/>   </div></template><script>export default {    data(){      return{        msg:'月落烏啼霜滿天'      }}}</script>
      登錄后復(fù)制

      這邊使用的是 v-model 將輸入框的值與msg綁定 ,還可以是v-text v-html v-bind等

      vue使用什么綁定數(shù)據(jù)

      1.單向數(shù)據(jù)綁定(v-bind):數(shù)據(jù)只能從data流回頁面(單向傳遞)

      2.雙向數(shù)據(jù)綁定(v-model):數(shù)據(jù)不僅可以從data流向頁面,還可以從頁面流向data

      (1)雙向數(shù)據(jù)綁定一般都應(yīng)用在表單類元素上(如:input select checkbox等)

      (2)v-model:value 可以簡寫為 v-model 因?yàn)関-model默認(rèn)收集的就是value值

      三、標(biāo)簽屬性前加 ‘ :’ 綁定

      <template>    <div class="mainBody">     <CellGroup>       <Cell :title="msg"/>     </CellGroup>    </div></template><script>export default {    data(){      return{        msg:'月落烏啼霜滿天',      }}}</script>
      登錄后復(fù)制

      vue使用什么綁定數(shù)據(jù)

      通過:title 將msg的值綁定到cell單元格的title,如果title屬性前面忘記加‘ :’的話,頁面展示就會變成這樣:

      vue使用什么綁定數(shù)據(jù)

      給到title的值就不是data()中的變量 msg 而是字符串“msg”了

      四、數(shù)據(jù)前拼接字符串用`${}`

      <template><!-- 有時我們需要給要綁定的值拼接字符串,比如需要控制樣式,拼接字符串時,那我們就需要這樣寫`${}`, -->   <div class="mainBody">     <CellGroup>       <Cell :title="msg"/>        <!-- 將‘江楓漁火對愁眠’單元格 的背景色綁定到 color:'aqua' -->       <Cell title='江楓漁火對愁眠' :style="`background-color: ${color}`"/>        <!-- 將‘江楓漁火對愁眠’拼接在msg:'月落烏啼霜滿天'后-->       <Cell :title="`${msg},江楓漁火對愁眠`" />     </CellGroup>    </div></template><script>export default {    data(){      return{        msg:'月落烏啼霜滿天',        color:'aqua'      }}}</script>
      登錄后復(fù)制

      vue使用什么綁定數(shù)據(jù)

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號-2    滬公網(wǎng)安備31011702889846號