Vue

1.Vue:Vue.js(讀音 /vju?/, 類似于 view)是一個(gè)構(gòu)建數(shù)據(jù)驅(qū)動(dòng)的 web 界面的漸進(jìn)式框架。Vue.js 的目標(biāo)是通過盡可能簡(jiǎn)單的 API 實(shí)現(xiàn)響應(yīng)的數(shù)據(jù)綁定和組合的視圖組件。它不僅易于上手,還便于與第三方庫或既有項(xiàng)目整合。另一方面,當(dāng)與單文件組件Vue 生態(tài)系統(tǒng)支持的庫結(jié)合使用時(shí),Vue 也完全能夠?yàn)閺?fù)雜的單頁應(yīng)用程序提供驅(qū)動(dòng)。

2.下載Vue? 輸入指令 ump install vue,下載完畢之后出現(xiàn)文件夾即可

3.vue內(nèi)容:

? ? ?? new Vue({ //element元素

? ? ? ? ? ? el:'#itany',

? ? ? ? ? ? data:{//寫數(shù)據(jù)

? ? ? ? ? ? ? ? table

?? ? })

4.循環(huán)數(shù)組:

div:

<div id="mingzi">

<ul>

<li v-for="a in arr">{{a}}</li>

</ul>

</div>

js:

new Vue({

el:'#mingzi',

data:{

arr:[1,2,3]

}

})

5.循環(huán)對(duì)象:

div:

<div id="mingzi">

<ul>

<li v-for="a in obj"><<a>></li>

</ul>

</div>

js:

new Vue({

el:'#mingzi',

data:{

obj:{name:"社會(huì)王",age:"18歲"}

}

})

6.循環(huán)下標(biāo):

div:

<div id="mingzi">

    <ul>

    <li v-for="(a,index) in arr"><<a>><<index>></li>

    </ul>

    </div>

      js:

      new Vue({

      el:'#mingzi',

      data:{

      arr:[1,2,3]

      }

      })

      7.循環(huán)表格:

      div:

      <div id ="itany">

      <table>

      <thead>

      <tr>

      <th>編號(hào)</th>

      <th>名稱</th>

      <th>單價(jià)</th>

      </tr>

      </thead>

      <table>

      <tr v-for="(value,index) in arr">

      ? ? ? ? ? ? ? ? <td>{{index+1}}</td>

      ? ? ? ? ? ? ? ? ? <td>{{value.pname}}</td>

      ? ? ? ? ? ? ? ? ? <td>{{value.price}}</td>

      </tr>

      </table>

      </table>

      </div>

      js:

      new Vue({

      el:'#itany',

      data:{

      ? ? arr:[

      ? ? ? ? ? ? ? ? ? ? ? ? {pname:"葡萄",price:1},

      ? ? ? ? ? ? ? ? ? ? ? ? {pname:"香蕉",price:2},

      ? ? ? ? ? ? ? ? ? ? ? ? {pname:"蘋果",price:3},

      ? ? ? ? ? ? ? ? ? ? ? ]

      }

      })

      ?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
      【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
      平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

      相關(guān)閱讀更多精彩內(nèi)容

      友情鏈接更多精彩內(nèi)容