v-model实现的原理

v-model实现的原理

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
<div id="app">
    {{message}}
  <input type="text" @input="inputhandle" :value="message">
</div>
<script src="../vue.js"></script>
<script>
  const app = new Vue({
    el: '#app',
    data: {
      message: 'hello'
    },
    methods: {
      inputhandle(e){
        console.log('----',e.target.value)
        this.message = e.target.value
      }
    }
  })
</script>
</body>
</html>
原文地址:https://www.cnblogs.com/ch2020/p/14839147.html