问题:之前对vue属性不是太理解,项目里选择日期插件用上了。
解答:
基本用法:监听数据的变化,进行对应的操作
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv="Content-Language" content="zh-CN">
<meta name="keywords" content="HTML XHTML"/>
<meta name="description" content="html toturial and html books"/>
<meta name="robots" content="noindex"/>
<meta name="author" content=""/>
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache">
<meta http-equiv="Expires" content="0">
<link rel="Bookmark" href="favicon.ico">
<link rel="Shortcut Icon" href="favicon.ico">
</head>
<body>
<div id="app" class="login_area">
<div class="form_line">
<label>测试:</label>
<input v-model="password" placeholder="请再次输入密码" />
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/vue@2.5.17/dist/vue.js"></script>
<script>
var vm = new Vue({
el: '#app',
data() {
return {
password:''
}
},
watch:{
password: function (val, oldVal) {
console.log('new: %s, old: %s', val, oldVal)
},
}
})
</script>
</body>
</html>
高级用法后期总结