forked from apache/incubator-weex-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.vue
200 lines (185 loc) 路 4.22 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
<!-- CopyRight (C) 2017-2022 Alibaba Group Holding Limited. -->
<!-- Created by Tw93 on 16/11/07. -->
<!--A dialog. -->
<template>
<div class="container">
<wxc-overlay v-if="show" :show="true" :hasAnimation="false"></wxc-overlay>
<div class="dialog-box" v-if="show" :style="{top:top+'px'}">
<div class="dialog-content">
<slot name="title">
<text class="content-title">{{title}}</text>
</slot>
<slot name="content">
<text class="content-subtext">{{content}}</text>
</slot>
<div class="no-prompt"
v-if="showNoPrompt"
@click="noPromptClicked">
<image :src="noPromptIcon" class="no-prompt-icon"></image>
<text class="no-prompt-text">{{noPromptText}}</text>
</div>
</div>
<div class="dialog-footer">
<div class="footer-btn cancel"
v-if="!single"
@click="secondaryClicked">
<text class="btn-text" :style="{ color: secondBtnColor }">{{cancelText}}</text>
</div>
<div class="footer-btn confirm" @click="primaryClicked">
<text class="btn-text" :style="{ color: mainBtnColor }">{{confirmText}}</text>
</div>
</div>
</div>
</div>
</template>
<style scoped>
.container {
position: fixed;
width: 750px;
/*鍏煎H5寮傚父*/
z-index: 99999;
}
.dialog-box {
position: fixed;
left: 96px;
width: 558px;
background-color: #FFFFFF;
}
.dialog-content {
padding-top: 36px;
padding-bottom: 36px;
padding-left: 36px;
padding-right: 36px;
}
.content-title {
color: #333333;
font-size: 36px;
text-align: center;
margin-bottom: 24px;
}
.content-subtext {
color: #666666;
font-size: 26px;
line-height: 36px;
text-align: center;
}
.dialog-footer {
flex-direction: row;
align-items: center;
border-top-color: #F3F3F3;
border-top-width: 1px;
}
.footer-btn {
flex-direction: row;
align-items: center;
justify-content: center;
flex: 1;
height: 90px;
}
.cancel {
border-right-color: #F3F3F3;
border-right-width: 1px;
}
.btn-text {
font-size: 36px;
color: #666666;
}
.no-prompt {
width: 486px;
align-items: center;
justify-content: center;
flex-direction: row;
margin-top: 24px;
}
.no-prompt-icon {
width: 24px;
height: 24px;
margin-right: 12px;
}
.no-prompt-text {
font-size: 24px;
color: #A5A5A5;
}
</style>
<script>
import WxcOverlay from '../wxc-overlay'
import { CHECKED, UN_CHECKED } from './type';
export default {
components: { WxcOverlay },
props: {
show: {
type: Boolean,
default: false
},
single: {
type: Boolean,
default: false
},
title: {
type: String,
default: ''
},
content: {
type: String,
default: ''
},
top: {
type: Number,
default: 400
},
cancelText: {
type: String,
default: '鍙栨秷'
},
confirmText: {
type: String,
default: '纭畾'
},
mainBtnColor: {
type: String,
default: '#EE9900'
},
secondBtnColor: {
type: String,
default: '#666666'
},
showNoPrompt: {
type: Boolean,
default: false
},
noPromptText: {
type: String,
default: '涓嶅啀鎻愮ず'
},
isChecked: {
type: Boolean,
default: false
}
},
data: () => ({
noPromptIcon: UN_CHECKED,
pageHeight: 1334
}),
created () {
const { env: { deviceHeight, deviceWidth } } = weex.config;
this.pageHeight = deviceHeight / deviceWidth * 750;
},
methods: {
secondaryClicked () {
this.$emit('wxcDialogCancelBtnClicked', {
type: 'cancel'
});
},
primaryClicked (e) {
this.$emit('wxcDialogConfirmBtnClicked', {
type: 'confirm'
});
},
noPromptClicked (e) {
const isChecked = !this.isChecked;
this.noPromptIcon = isChecked ? CHECKED : UN_CHECKED;
this.$emit('wxcDialogNoPromptClicked', { isChecked });
}
}
};
</script>