You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<html><head><linkrel="stylesheet" href="index.css"><scriptsrc="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script></head><body><divid="app-2"><spanv-bind:title="message">
Hover your mouse over me for a few seconds
to see my dynamically bound title!
</span></div><scriptsrc="index.js"></script></body></html>
Js
varapp2=newVue({el: '#app-2',data: {message: 'You loaded this page on '+newDate().toLocaleString()}})
View
テキストにマウスカーソルを合わせると現在時刻が表示される
この現在時刻が動的に更新されていくわけではないようだ
何度カーソルを当てたり外したりしても、値は変わらないようだ
確かにサンプルでもメッセージは「このページをロードした時刻」という表現になっている ( You loaded this page on )
ざっくり
v-bind は Model の値を HTML コンポーネントに反映(出力)します。HTML コンポーネントの値が変わっても、Model の値は変わりません。Model から HTML への一方通行です。
一方、v-model は Model と View(HTML)の双方向に影響します。 HTML コンポーネントの値に変更があった場合、自動で Model の値を更新します。
The text was updated successfully, but these errors were encountered:
Tutorial
Introduction — Vue.js
Codpen
Vue.js Playground
HTML
v-bind:title="message
という書き方で HTML 的な title 属性の中身を、 js data の message に紐づけているみたいだ。リストレンダリング — Vue.js
Js
View
You loaded this page on
)NOTE
v-model
という方式もあるらしい。【Vue】v-bind と v-model の違い - 山崎屋の技術メモ
The text was updated successfully, but these errors were encountered: