-
Notifications
You must be signed in to change notification settings - Fork 0
/
11.html
47 lines (45 loc) · 831 Bytes
/
11.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>task-11</title>
<script src="vue/vue.js"></script>
<style>
</style>
</head>
<body>
<input id="app-01" v-focus>111
<div id="app-02" v-swatch="{color:'#125678'}">111</div>
<script>
// Vue.directive('focus',{
// inserted:function(el){
// el.focus()
// }
// })
var app01=new Vue({
el:'#app-01',
directives:{
focus:{
inserted:function(el){
el.focus()
}
}
}
})
Vue.directive('swatch',function(el,binding){
el.style.backgroundColor=binding.value
})
var app02=new Vue({
el:'#app-02',
data:{
message:"hello"
},
directives:{
swatch:function(el,binding,v){
el.style.backgroundColor=binding.value.color
}
}
})
</script>
</body>
</html>