Skip to content

Commit c1ba26e

Browse files
committed
update
1 parent 4763c26 commit c1ba26e

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html xmlns="http://www.w3.org/1999/html">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>vuejs练习</title>
6+
7+
</head>
8+
<body>
9+
<div id="demo" v-demo:hello="msg"></div>
10+
<script src='http://cdn.jsdelivr.net/vue/1.0.26/vue.min.js'></script>
11+
<script src="index.js"></script>
12+
</body>
13+
</html>

vuejs练习/自定义指令/index.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Vue.directive('demo', {
2+
bind: function () {
3+
console.log('demo bound!')
4+
},
5+
update: function (value) {
6+
this.el.innerHTML =
7+
'name - ' + this.name + '<br>' +
8+
'expression - ' + this.expression + '<br>' +
9+
'argument - ' + this.arg + '<br>' +
10+
'modifiers - ' + JSON.stringify(this.modifiers) + '<br>' +
11+
'value - ' + value
12+
}
13+
})
14+
var demo = new Vue({
15+
el: '#demo',
16+
data: {
17+
msg: 'hello!'
18+
}
19+
})

0 commit comments

Comments
 (0)