vue 組件 模板input雙向數據數據
阿新 • • 發佈:2018-03-04
inpu tms 組件 data msg tle pro scrip 模板
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Title of page</title>
</head>
<body>
<div id="example">
<input v-model="parentMsg">
<br>
<child v-bind:my-message="parentMsg"></child>
</div>
</body>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.js"></script>
<script >
// 註冊
Vue.component(‘child‘, {
props: [‘myMessage‘],
template: ‘<span>{{ myMessage }}</span>‘
})
// 創建根實例
new Vue({
el: ‘#example‘,
data:{
parentMsg:‘‘
}
})
</script>
</html>
vue 組件 模板input雙向數據數據