We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b25c18b commit 5a0983eCopy full SHA for 5a0983e
index.html
@@ -7,6 +7,8 @@
7
<body>
8
<h1 id="name"></h1>
9
<input type="text">
10
+ <input type="button" value="改变data内容" onclick="changeInput()">
11
+
12
<script src="observer.js"></script>
13
<script src="watcher.js"></script>
14
<script>
@@ -22,14 +24,20 @@ <h1 id="name"></h1>
22
24
23
25
var ele = document.querySelector('#name');
26
var input = document.querySelector('input');
-
27
28
var myVue = new myVue({
- name: 'hello world'
- }, ele, 'name');
29
+ name: 'hello world'
30
+ }, ele, 'name');
31
32
+ //改变输入框内容
33
input.oninput = function (e) {
34
myVue.data.name = e.target.value
35
}
36
+ //改变data内容
37
+ function changeInput(){
38
+ myVue.data.name = "难凉热血"
39
40
+ }
41
</script>
42
</body>
43
</html>
0 commit comments