-
Notifications
You must be signed in to change notification settings - Fork 7
/
index.html
158 lines (157 loc) · 4.75 KB
/
index.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>vue-easycm</title>
<link href="src/iconfont/iconfont.css" rel="stylesheet">
<style>
html,body{
width: 100%;
height: 100%;
/*overflow: hidden;*/
margin: 0;
padding: 0;
}
#app {
font-family: 'Avenir', Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin: 0 ;
padding: 0;
width: 100%;
height: 200%;
}
h1, h2 {
font-weight: normal;
}
.li-6 .easy-cm-ul li{
background-color: #df5000;
color: #ffffff;
}
.li-6 .easy-cm-ul li div:hover{
background-color: #ffffff!important;
color: #df5000!important;
}
.demo-ul{
width: 100%;
padding: 10px;
list-style: none;
text-align: center;
}
.demo-ul>li{
width: 80px;
font-size: 14px;
height: 80px;
line-height: 80px;
margin: 20px;
background-color: #ccc;
float: left;
color: #ffffff;
}
</style>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="./dist/vue-easycm.js"></script>
</head>
<body>
<div id="app">
<img src="./src/assets/logo.png">
<h1>{{ msg }}</h1>
<h3>在小方块上右击展示</h3>
<h4>调整网页宽高查看边界检测</h4>
<ul class="demo-ul">
<li @contextmenu="$easycm($event,$root,1)" style="background-color:#509992;">
<easy-cm :list="[{text: 'Hello '},{text: 'World '}]" :tag="1"></easy-cm>
最简
</li>
<li @contextmenu="$easycm($event,$root,2)" style="background-color:#dd8896;">
<easy-cm :list="[{text: 'Hello '},{text: 'World '}]" :underline="true" :tag="2"></easy-cm>
下划线
</li>
<li @contextmenu="$easycm($event,$root,3)" style="background-color:#ddc663;">
<easy-cm :list="[{text: 'Hello '},{text: 'More',children:[{text:'Boen'},{text:'World'}]}]" :underline="true" :arrow="true" :tag="3"></easy-cm>
子层箭头
</li>
<li @contextmenu="$easycm($event,$root,4)" style="background-color:#d4b4dd;">
<easy-cm :list="[{
text: 'Play Now',
icon: 'iconfont icon-bofang'
},{
text: 'Play Next',
icon: 'iconfont icon-xiayishou'
}]" :underline="true" :arrow="true" :tag="4"></easy-cm>
字体图标
</li>
<li @contextmenu="$easycm($event,$root,5)" style="background-color:#a5dd68;">
<easy-cm :list="cmList" :underline="true" :arrow="true" :tag="5"></easy-cm>
多层菜单
</li>
<li @contextmenu="$easycm($event,$root,8)" style="background-color:#80a0ff;">
<easy-cm :list="cmList" :underline="true" :arrow="true" :tag="8" :offset="{x:20,y:20}"></easy-cm>
触发点偏移
</li>
<li @contextmenu="$easycm($event,$root,9)" style="background-color:#ffb4d2;">
<easy-cm :list="cmList" :underline="true" :arrow="true" :tag="9" :item-width="200" :item-height="50"></easy-cm>
选项宽高
</li>
<li class="li-6" @contextmenu="$easycm($event,$root,6)" style="background-color:#ffaa5d;">
<easy-cm :list="cmList" :underline="true" :arrow="true" :tag="6"></easy-cm>
自定义样式
</li>
<li @contextmenu="$easycm($event,$root,7)" style="background-color:#58c0dd;">
<easy-cm :list="cmList" @ecmcb="test" :underline="true" :arrow="true" :tag="7"></easy-cm>
回调函数
</li>
</ul>
</div>
</body>
<script>
var app = new Vue({
el: '#app',
data:{
msg: 'Welcome to Your Vue.js App',
cmList: [{
text: 'Play Now',
icon: 'iconfont icon-bofang'
},{
text: 'Play Next',
icon: 'iconfont icon-xiayishou'
},{
text: 'More',
children: [{
text: 'Download',
children: []
},{
text: 'Report'
},{
text: 'Other',
icon: 'iconfont icon-bofang',
children:[{
text: 'Other-1'
},{
text: 'Other-2'
},{
text: 'Other-3'
}]
}]
}]
},
methods:{
test(indexList){
switch (indexList[0]){
case 0:
alert('立即播放');
break
case 1:
alert('下一首播放')
break
default:
alert('其他的')
break
}
}
}
})
</script>
</html>