-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
Copy pathindex10.html
51 lines (48 loc) · 1.19 KB
/
index10.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
48
49
50
51
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>新组件系统测试</title>
<script type="text/javascript" src="../../dist/avalon.js"></script>
</head>
<body>
<div ms-controller='widget1' >
<ms-panel ms-widget="{id:'eee'}">{{@aaa}}</ms-panel>
</div>
<h1>ms-panel+ms-button组件</h1>
<script type="text/javascript">
function heredoc(fn) {
return fn.toString().replace(/^[^\/]+\/\*!?\s?/, '').
replace(/\*\/[^\/]+$/, '').trim().replace(/>\s*</g, '><')
}
avalon.component('ms-panel', {
template: heredoc(function () {
/*
<div>
<div class="body" ms-attr="{title:@k}">
<slot name="body"></slot>
</div>
<p><ms-button :widget="@button" /></p>
</div>
*/
}),
defaults: {
k: 33,
body: " ",
onViewChange: function (e) {
avalon.log(e.type, 'ms-panel')
},
button: {
buttonText: 'click me!'
}
},
soleSlot: 'body'
})
var vm = avalon.define({
$id: 'widget1',
aaa: 111,
bbb: 111
})
</script>
</body>
</html>