声明式渲染
Vue.js 的核心是一个允许采用简洁的模板语法来声明式地将数据渲染进 DOM 的系统:
<div id="bind-attribute" class="demo"> <span v-bind:title="message"> Hover your mouse over me for a few seconds to see my dynamically-bound title! </span> </div>
.demo { font-family: sans-serif; border: 1px solid #eee; border-radius: 2px; padding: 20px 30px; margin-top: 1em; margin-bottom: 40px; user-select: none; overflow-x: auto; }
const AttributeBindingApp = { data() { return { message: 'You loaded this page on ' + new Date().toLocaleString() } } } Vue.createApp(AttributeBindingApp).mount('#bind-attribute')