This repository has been archived by the owner on Jun 3, 2021. It is now read-only.
/
index.vue
221 lines (203 loc) · 6.88 KB
/
index.vue
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<!-- Created by Tw93 on 16/11/03. -->
<template>
<div class="wxc-demo">
<scroller class="container">
<title title="wxc-cell"></title>
<category title="Basic Style"></category>
<div class="demo">
<wxc-cell label="Title"
@wxcCellClicked="wxcCellClicked"
:has-margin="false"
extraContent="extra content"></wxc-cell>
</div>
<category title="Subtitle"></category>
<div class="demo">
<wxc-cell title="Title"
desc="subtitle"
:has-arrow="true"
@wxcCellClicked="wxcCellClicked"
:has-top-border="true"></wxc-cell>
<wxc-cell title="Listltem (Android)"
desc="There may have water ripple effect of material if you set the click event."
:has-arrow="true"
@wxcCellClicked="wxcCellClicked"
:has-top-border="true"></wxc-cell>
</div>
<category title="Customized Right Side(Empty Content / Text)"></category>
<div class="demo">
<wxc-cell label="Title"
@wxcCellClicked="wxcCellClicked"
:has-margin="false"></wxc-cell>
<wxc-cell label="Title"
:has-arrow="true"
@wxcCellClicked="wxcCellClicked"
:has-top-border="false"></wxc-cell>
<wxc-cell title="Title"
:has-arrow="true"
@wxcCellClicked="wxcCellClicked"
:has-top-border="true"
extraContent="extra content"></wxc-cell>
</div>
<category title="Align Vertical Center"></category>
<div class="demo">
<wxc-cell title="Title"
desc="subtitle"
@wxcCellClicked="wxcCellClicked"
:has-top-border="true"
extraContent="extra content"></wxc-cell>
</div>
<category title="Text Wrapping"></category>
<div class="demo">
<wxc-cell desc="Multiple line,long text will wrap;Long Text Long Text Long Text Long Text Long Text Long Text"
@wxcCellClicked="wxcCellClicked"
:has-top-border="true"></wxc-cell>
<wxc-cell desc="Multiple line,long text will wrap;Long Text Long Text Long Text Long Text Long Text Long Text"
@wxcCellClicked="wxcCellClicked"
:has-top-border="true"
extraContent="extra content"></wxc-cell>
</div>
<category title="Text content"></category>
<div class="demo">
<wxc-cell label="title"
title="content title"
@wxcCellClicked="wxcCellClicked"
:has-margin="false"></wxc-cell>
<wxc-cell label="title"
title="link"
:has-arrow="true"
:link="link"
@wxcCellClicked="wxcCellClicked"
:has-top-border="false"></wxc-cell>
<wxc-cell label="title"
title="content title"
:has-arrow="true"
@wxcCellClicked="wxcCellClicked"
:has-top-border="false"></wxc-cell>
<wxc-cell title="content title"
:has-arrow="true"
@wxcCellClicked="wxcCellClicked"
:has-top-border="false"></wxc-cell>
</div>
<category title="Custom cell" class="category"></category>
<div class="demo">
<wxc-cell title="title content"
desc="desc"
:has-arrow="true"
@wxcCellClicked="wxcCellClicked"
:has-top-border="true"></wxc-cell>
</div>
<div class="demo">
<wxc-cell :has-arrow="false"
:has-top-border="false"
:auto-accessible="false">
<text :style="{color:color}"
slot="title">custom title content</text>
<switch slot="value"
@change="color= color==='#000' ? '#FFC900' : '#000'"></switch>
</wxc-cell>
<wxc-cell :has-arrow="false"
:cell-style="cellStyle"
:has-top-border="false"
:auto-accessible="false">
<image class="image"
slot="label"
src="https://img.alicdn.com/tfs/TB1eLvjSXXXXXaiXXXXXXXXXXXX-144-166.jpg"></image>
<text class="red"
slot="title">A custom title, style can also be added to the picture
</text>
</wxc-cell>
</div>
</scroller>
</div>
</template>
<style scoped>
.wxc-demo {
width: 750px;
position: absolute;
top: 0;
right: 0;
left: 0;
bottom: 0;
background-color: #ffffff;
}
.container {
flex: 1;
}
.demo {
width: 750px;
background-color: #f2f3f4;
}
.category {
margin-top: 40px;
}
.default {
color: #000000;
}
.active {
color: #FFC900;
}
.red {
color: #C3413D;
}
.image {
width: 80px;
height: 80px;
margin-right: 20px;
}
.demo-title {
font-size: 30px;
color: #333333;
margin-top: 30px;
margin-left: 30px;
margin-bottom: 16px;
}
</style>
<script>
const modal = weex.requireModule('modal');
import { WxcCell } from '../../index';
import Title from '../_mods/title.vue';
import Category from '../_mods/category.vue';
import { setTitle } from '../_mods/set-nav';
export default {
components: { WxcCell, Title, Category },
created () {
setTitle('Cell');
// 兼容weex playground的显示 正常业务不要用
const { appName } = weex.config.env;
if (/(WeexDemo)/i.test(appName)) {
this.link = 'https://h5.m.taobao.com/trip/weex-ui/demo/index.native-min.js';
}
},
data: () => ({
color: '#000',
cellStyle: {
backgroundColor: '#f2f3f4'
},
link: 'https://h5.m.taobao.com/trip/weex-ui/index.html?_wx_tpl=https%3A%2F%2Fh5.m.taobao.com%2Ftrip%2Fweex-ui%2Fdemo%2Findex.native-min.js'
}),
methods: {
wxcCellClicked (e) {
modal.toast({
'message': 'wxcCellClicked',
'duration': 1
})
}
}
};
</script>