Vue.js Concise Memo

Original link: https://hsiaofeng.com/archives/206.html

This is a study note for personal use.

introduce

 <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>

template syntax

text interpolation

 <span>Message: </span>
 const { createApp } = Vue; let test = createApp ({ data(){ return { msg: "Hello" } } }); test.mount("#app");

property binding

Bind one or more tag properties via Vue.

 <div v-bind:id="dynamicId"></div> <!-- 简写--> <div :id="dynamicId"></div> <!-- 绑定多个属性--> <div v-bind="atrs"></div>
 let test = createApp ({ data(){ return { attrs : { id : "element-id", class : "element-class" } } } });

This article is reproduced from: https://hsiaofeng.com/archives/206.html
This site is for inclusion only, and the copyright belongs to the original author.