@kengic/uni 0.3.2-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/index.css +1 -0
- package/dist/kengic-uni.js +5 -0
- package/dist/src/consts/i18n/en.d.ts +45 -0
- package/dist/src/consts/i18n/index.d.ts +90 -0
- package/dist/src/consts/i18n/zh_CN.d.ts +45 -0
- package/dist/src/consts/index.d.ts +1 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/utils/index.d.ts +1 -0
- package/dist/src/utils/kg.util.d.ts +5 -0
- package/dist/uni-ui/index.ts +11 -0
- package/dist/uni-ui/uni-badge/uni-badge.vue +253 -0
- package/dist/uni-ui/uni-breadcrumb/uni-breadcrumb.vue +41 -0
- package/dist/uni-ui/uni-breadcrumb-item/uni-breadcrumb-item.vue +121 -0
- package/dist/uni-ui/uni-calendar/calendar.js +546 -0
- package/dist/uni-ui/uni-calendar/i18n/en.json +12 -0
- package/dist/uni-ui/uni-calendar/i18n/index.js +8 -0
- package/dist/uni-ui/uni-calendar/i18n/zh-Hans.json +12 -0
- package/dist/uni-ui/uni-calendar/i18n/zh-Hant.json +12 -0
- package/dist/uni-ui/uni-calendar/uni-calendar-item.vue +187 -0
- package/dist/uni-ui/uni-calendar/uni-calendar.vue +566 -0
- package/dist/uni-ui/uni-calendar/util.js +360 -0
- package/dist/uni-ui/uni-card/uni-card.vue +281 -0
- package/dist/uni-ui/uni-col/uni-col.vue +317 -0
- package/dist/uni-ui/uni-collapse/uni-collapse.vue +147 -0
- package/dist/uni-ui/uni-collapse-item/uni-collapse-item.vue +402 -0
- package/dist/uni-ui/uni-combox/uni-combox.vue +294 -0
- package/dist/uni-ui/uni-countdown/i18n/en.json +6 -0
- package/dist/uni-ui/uni-countdown/i18n/index.js +8 -0
- package/dist/uni-ui/uni-countdown/i18n/zh-Hans.json +6 -0
- package/dist/uni-ui/uni-countdown/i18n/zh-Hant.json +6 -0
- package/dist/uni-ui/uni-countdown/uni-countdown.vue +267 -0
- package/dist/uni-ui/uni-data-checkbox/uni-data-checkbox.vue +821 -0
- package/dist/uni-ui/uni-data-picker/keypress.js +45 -0
- package/dist/uni-ui/uni-data-picker/uni-data-picker.vue +551 -0
- package/dist/uni-ui/uni-data-pickerview/uni-data-picker.js +622 -0
- package/dist/uni-ui/uni-data-pickerview/uni-data-pickerview.vue +323 -0
- package/dist/uni-ui/uni-data-select/uni-data-select.vue +517 -0
- package/dist/uni-ui/uni-dateformat/date-format.js +200 -0
- package/dist/uni-ui/uni-dateformat/uni-dateformat.vue +88 -0
- package/dist/uni-ui/uni-datetime-picker/calendar-item.vue +177 -0
- package/dist/uni-ui/uni-datetime-picker/calendar.vue +928 -0
- package/dist/uni-ui/uni-datetime-picker/i18n/en.json +22 -0
- package/dist/uni-ui/uni-datetime-picker/i18n/index.js +8 -0
- package/dist/uni-ui/uni-datetime-picker/i18n/zh-Hans.json +22 -0
- package/dist/uni-ui/uni-datetime-picker/i18n/zh-Hant.json +22 -0
- package/dist/uni-ui/uni-datetime-picker/time-picker.vue +934 -0
- package/dist/uni-ui/uni-datetime-picker/uni-datetime-picker.vue +1026 -0
- package/dist/uni-ui/uni-datetime-picker/util.js +403 -0
- package/dist/uni-ui/uni-drawer/keypress.js +45 -0
- package/dist/uni-ui/uni-drawer/uni-drawer.vue +181 -0
- package/dist/uni-ui/uni-easyinput/common.js +56 -0
- package/dist/uni-ui/uni-easyinput/uni-easyinput.vue +660 -0
- package/dist/uni-ui/uni-fab/uni-fab.vue +491 -0
- package/dist/uni-ui/uni-fav/i18n/en.json +4 -0
- package/dist/uni-ui/uni-fav/i18n/index.js +8 -0
- package/dist/uni-ui/uni-fav/i18n/zh-Hans.json +4 -0
- package/dist/uni-ui/uni-fav/i18n/zh-Hant.json +4 -0
- package/dist/uni-ui/uni-fav/uni-fav.vue +161 -0
- package/dist/uni-ui/uni-file-picker/choose-and-upload-file.js +224 -0
- package/dist/uni-ui/uni-file-picker/uni-file-picker.vue +667 -0
- package/dist/uni-ui/uni-file-picker/upload-file.vue +325 -0
- package/dist/uni-ui/uni-file-picker/upload-image.vue +292 -0
- package/dist/uni-ui/uni-file-picker/utils.js +109 -0
- package/dist/uni-ui/uni-forms/uni-forms.vue +398 -0
- package/dist/uni-ui/uni-forms/utils.js +293 -0
- package/dist/uni-ui/uni-forms/validate.js +486 -0
- package/dist/uni-ui/uni-forms-item/uni-forms-item.vue +601 -0
- package/dist/uni-ui/uni-goods-nav/i18n/en.json +6 -0
- package/dist/uni-ui/uni-goods-nav/i18n/index.js +8 -0
- package/dist/uni-ui/uni-goods-nav/i18n/zh-Hans.json +6 -0
- package/dist/uni-ui/uni-goods-nav/i18n/zh-Hant.json +6 -0
- package/dist/uni-ui/uni-goods-nav/uni-goods-nav.vue +229 -0
- package/dist/uni-ui/uni-grid/uni-grid.vue +143 -0
- package/dist/uni-ui/uni-grid-item/uni-grid-item.vue +129 -0
- package/dist/uni-ui/uni-group/uni-group.vue +134 -0
- package/dist/uni-ui/uni-icons/icons.js +1169 -0
- package/dist/uni-ui/uni-icons/uni-icons.vue +96 -0
- package/dist/uni-ui/uni-icons/uniicons.css +663 -0
- package/dist/uni-ui/uni-icons/uniicons.ttf +0 -0
- package/dist/uni-ui/uni-indexed-list/uni-indexed-list-item.vue +144 -0
- package/dist/uni-ui/uni-indexed-list/uni-indexed-list.vue +367 -0
- package/dist/uni-ui/uni-link/uni-link.vue +128 -0
- package/dist/uni-ui/uni-list/uni-list.vue +123 -0
- package/dist/uni-ui/uni-list/uni-refresh.vue +65 -0
- package/dist/uni-ui/uni-list/uni-refresh.wxs +87 -0
- package/dist/uni-ui/uni-list-ad/uni-list-ad.vue +107 -0
- package/dist/uni-ui/uni-list-chat/uni-list-chat.scss +58 -0
- package/dist/uni-ui/uni-list-chat/uni-list-chat.vue +593 -0
- package/dist/uni-ui/uni-list-item/uni-list-item.vue +534 -0
- package/dist/uni-ui/uni-load-more/i18n/en.json +5 -0
- package/dist/uni-ui/uni-load-more/i18n/index.js +8 -0
- package/dist/uni-ui/uni-load-more/i18n/zh-Hans.json +5 -0
- package/dist/uni-ui/uni-load-more/i18n/zh-Hant.json +5 -0
- package/dist/uni-ui/uni-load-more/uni-load-more.vue +399 -0
- package/dist/uni-ui/uni-nav-bar/uni-nav-bar.vue +357 -0
- package/dist/uni-ui/uni-nav-bar/uni-status-bar.vue +24 -0
- package/dist/uni-ui/uni-notice-bar/uni-notice-bar.vue +426 -0
- package/dist/uni-ui/uni-number-box/uni-number-box.vue +221 -0
- package/dist/uni-ui/uni-pagination/i18n/en.json +5 -0
- package/dist/uni-ui/uni-pagination/i18n/es.json +5 -0
- package/dist/uni-ui/uni-pagination/i18n/fr.json +5 -0
- package/dist/uni-ui/uni-pagination/i18n/index.js +12 -0
- package/dist/uni-ui/uni-pagination/i18n/zh-Hans.json +5 -0
- package/dist/uni-ui/uni-pagination/i18n/zh-Hant.json +5 -0
- package/dist/uni-ui/uni-pagination/uni-pagination.vue +465 -0
- package/dist/uni-ui/uni-popup/i18n/en.json +7 -0
- package/dist/uni-ui/uni-popup/i18n/index.js +9 -0
- package/dist/uni-ui/uni-popup/i18n/zh-Hans.json +7 -0
- package/dist/uni-ui/uni-popup/i18n/zh-Hant.json +7 -0
- package/dist/uni-ui/uni-popup/keypress.js +45 -0
- package/dist/uni-ui/uni-popup/popup.js +23 -0
- package/dist/uni-ui/uni-popup/uni-popup.vue +464 -0
- package/dist/uni-ui/uni-popup-dialog/keypress.js +45 -0
- package/dist/uni-ui/uni-popup-dialog/uni-popup-dialog.vue +275 -0
- package/dist/uni-ui/uni-popup-message/uni-popup-message.vue +143 -0
- package/dist/uni-ui/uni-popup-share/uni-popup-share.vue +187 -0
- package/dist/uni-ui/uni-rate/uni-rate.vue +365 -0
- package/dist/uni-ui/uni-row/uni-row.vue +190 -0
- package/dist/uni-ui/uni-scss/changelog.md +8 -0
- package/dist/uni-ui/uni-scss/index.scss +1 -0
- package/dist/uni-ui/uni-scss/package.json +82 -0
- package/dist/uni-ui/uni-scss/readme.md +4 -0
- package/dist/uni-ui/uni-scss/styles/index.scss +7 -0
- package/dist/uni-ui/uni-scss/styles/setting/_border.scss +3 -0
- package/dist/uni-ui/uni-scss/styles/setting/_color.scss +66 -0
- package/dist/uni-ui/uni-scss/styles/setting/_radius.scss +55 -0
- package/dist/uni-ui/uni-scss/styles/setting/_space.scss +56 -0
- package/dist/uni-ui/uni-scss/styles/setting/_styles.scss +167 -0
- package/dist/uni-ui/uni-scss/styles/setting/_text.scss +24 -0
- package/dist/uni-ui/uni-scss/styles/setting/_variables.scss +146 -0
- package/dist/uni-ui/uni-scss/styles/tools/functions.scss +19 -0
- package/dist/uni-ui/uni-scss/theme.scss +31 -0
- package/dist/uni-ui/uni-scss/variables.scss +62 -0
- package/dist/uni-ui/uni-search-bar/i18n/en.json +4 -0
- package/dist/uni-ui/uni-search-bar/i18n/index.js +8 -0
- package/dist/uni-ui/uni-search-bar/i18n/zh-Hans.json +4 -0
- package/dist/uni-ui/uni-search-bar/i18n/zh-Hant.json +4 -0
- package/dist/uni-ui/uni-search-bar/uni-search-bar.vue +298 -0
- package/dist/uni-ui/uni-section/uni-section.vue +167 -0
- package/dist/uni-ui/uni-segmented-control/uni-segmented-control.vue +145 -0
- package/dist/uni-ui/uni-steps/uni-steps.vue +269 -0
- package/dist/uni-ui/uni-swipe-action/uni-swipe-action.vue +60 -0
- package/dist/uni-ui/uni-swipe-action-item/bindingx.js +302 -0
- package/dist/uni-ui/uni-swipe-action-item/isPC.js +12 -0
- package/dist/uni-ui/uni-swipe-action-item/mpalipay.js +195 -0
- package/dist/uni-ui/uni-swipe-action-item/mpother.js +260 -0
- package/dist/uni-ui/uni-swipe-action-item/mpwxs.js +84 -0
- package/dist/uni-ui/uni-swipe-action-item/render.js +270 -0
- package/dist/uni-ui/uni-swipe-action-item/uni-swipe-action-item.vue +347 -0
- package/dist/uni-ui/uni-swipe-action-item/wx.wxs +341 -0
- package/dist/uni-ui/uni-swiper-dot/uni-swiper-dot.vue +218 -0
- package/dist/uni-ui/uni-table/uni-table.vue +455 -0
- package/dist/uni-ui/uni-tag/uni-tag.vue +252 -0
- package/dist/uni-ui/uni-tbody/uni-tbody.vue +29 -0
- package/dist/uni-ui/uni-td/uni-td.vue +90 -0
- package/dist/uni-ui/uni-th/filter-dropdown.vue +511 -0
- package/dist/uni-ui/uni-th/uni-th.vue +285 -0
- package/dist/uni-ui/uni-thead/uni-thead.vue +129 -0
- package/dist/uni-ui/uni-title/uni-title.vue +171 -0
- package/dist/uni-ui/uni-tooltip/uni-tooltip.vue +68 -0
- package/dist/uni-ui/uni-tr/table-checkbox.vue +179 -0
- package/dist/uni-ui/uni-tr/uni-tr.vue +171 -0
- package/dist/uni-ui/uni-transition/createAnimation.js +131 -0
- package/dist/uni-ui/uni-transition/uni-transition.vue +281 -0
- package/package.json +90 -0
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="uni-goods-nav">
|
|
3
|
+
<!-- 底部占位 -->
|
|
4
|
+
<view class="uni-tab__seat" />
|
|
5
|
+
<view class="uni-tab__cart-box flex">
|
|
6
|
+
<view class="flex uni-tab__cart-sub-left">
|
|
7
|
+
<view v-for="(item,index) in options" :key="index" class="flex uni-tab__cart-button-left uni-tab__shop-cart" @click="onClick(index,item)">
|
|
8
|
+
<view class="uni-tab__icon">
|
|
9
|
+
<uni-icons :type="item.icon" size="20" color="#646566"></uni-icons>
|
|
10
|
+
<!-- <image class="image" :src="item.icon" mode="widthFix" /> -->
|
|
11
|
+
</view>
|
|
12
|
+
<text class="uni-tab__text">{{ item.text }}</text>
|
|
13
|
+
<view class="flex uni-tab__dot-box">
|
|
14
|
+
<text v-if="item.info" :class="{ 'uni-tab__dots': item.info > 9 }" class="uni-tab__dot " :style="{'backgroundColor':item.infoBackgroundColor?item.infoBackgroundColor:'#ff0000',
|
|
15
|
+
color:item.infoColor?item.infoColor:'#fff'
|
|
16
|
+
}">{{ item.info }}</text>
|
|
17
|
+
</view>
|
|
18
|
+
</view>
|
|
19
|
+
</view>
|
|
20
|
+
<view :class="{'uni-tab__right':fill}" class="flex uni-tab__cart-sub-right ">
|
|
21
|
+
<view v-for="(item,index) in buttonGroup" :key="index" :style="{background:item.backgroundColor,color:item.color}"
|
|
22
|
+
class="flex uni-tab__cart-button-right" @click="buttonClick(index,item)"><text :style="{color:item.color}" class="uni-tab__cart-button-right-text">{{ item.text }}</text></view>
|
|
23
|
+
</view>
|
|
24
|
+
</view>
|
|
25
|
+
</view>
|
|
26
|
+
</template>
|
|
27
|
+
|
|
28
|
+
<script>
|
|
29
|
+
import {
|
|
30
|
+
initVueI18n
|
|
31
|
+
} from '@dcloudio/uni-i18n'
|
|
32
|
+
import messages from './i18n'
|
|
33
|
+
const { t } = initVueI18n(messages)
|
|
34
|
+
/**
|
|
35
|
+
* GoodsNav 商品导航
|
|
36
|
+
* @description 商品加入购物车、立即购买等
|
|
37
|
+
* @tutorial https://ext.dcloud.net.cn/plugin?id=865
|
|
38
|
+
* @property {Array} options 组件参数
|
|
39
|
+
* @property {Array} buttonGroup 组件按钮组参数
|
|
40
|
+
* @property {Boolean} fill = [true | false] 组件按钮组参数
|
|
41
|
+
* @property {Boolean} stat 是否开启统计功能
|
|
42
|
+
* @event {Function} click 左侧点击事件
|
|
43
|
+
* @event {Function} buttonClick 右侧按钮组点击事件
|
|
44
|
+
* @example <uni-goods-nav :fill="true" options="" buttonGroup="buttonGroup" @click="" @buttonClick="" />
|
|
45
|
+
*/
|
|
46
|
+
export default {
|
|
47
|
+
name: 'UniGoodsNav',
|
|
48
|
+
emits:['click','buttonClick'],
|
|
49
|
+
props: {
|
|
50
|
+
options: {
|
|
51
|
+
type: Array,
|
|
52
|
+
default () {
|
|
53
|
+
return [{
|
|
54
|
+
icon: 'shop',
|
|
55
|
+
text: t("uni-goods-nav.options.shop"),
|
|
56
|
+
}, {
|
|
57
|
+
icon: 'cart',
|
|
58
|
+
text: t("uni-goods-nav.options.cart")
|
|
59
|
+
}]
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
buttonGroup: {
|
|
63
|
+
type: Array,
|
|
64
|
+
default () {
|
|
65
|
+
return [{
|
|
66
|
+
text: t("uni-goods-nav.buttonGroup.addToCart"),
|
|
67
|
+
backgroundColor: 'linear-gradient(90deg, #FFCD1E, #FF8A18)',
|
|
68
|
+
color: '#fff'
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
text: t("uni-goods-nav.buttonGroup.buyNow"),
|
|
72
|
+
backgroundColor: 'linear-gradient(90deg, #FE6035, #EF1224)',
|
|
73
|
+
color: '#fff'
|
|
74
|
+
}
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
fill: {
|
|
79
|
+
type: Boolean,
|
|
80
|
+
default: false
|
|
81
|
+
},
|
|
82
|
+
stat:{
|
|
83
|
+
type: Boolean,
|
|
84
|
+
default: false
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
methods: {
|
|
88
|
+
onClick(index, item) {
|
|
89
|
+
this.$emit('click', {
|
|
90
|
+
index,
|
|
91
|
+
content: item,
|
|
92
|
+
})
|
|
93
|
+
},
|
|
94
|
+
buttonClick(index, item) {
|
|
95
|
+
if (uni.report && this.stat) {
|
|
96
|
+
uni.report(item.text, item.text)
|
|
97
|
+
}
|
|
98
|
+
this.$emit('buttonClick', {
|
|
99
|
+
index,
|
|
100
|
+
content: item
|
|
101
|
+
})
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
</script>
|
|
106
|
+
|
|
107
|
+
<style lang="scss" >
|
|
108
|
+
.flex {
|
|
109
|
+
/* #ifndef APP-NVUE */
|
|
110
|
+
display: flex;
|
|
111
|
+
/* #endif */
|
|
112
|
+
flex-direction: row;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.uni-goods-nav {
|
|
116
|
+
/* #ifndef APP-NVUE */
|
|
117
|
+
display: flex;
|
|
118
|
+
/* #endif */
|
|
119
|
+
flex: 1;
|
|
120
|
+
flex-direction: row;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.uni-tab__cart-box {
|
|
124
|
+
flex: 1;
|
|
125
|
+
height: 50px;
|
|
126
|
+
background-color: #fff;
|
|
127
|
+
z-index: 900;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.uni-tab__cart-sub-left {
|
|
131
|
+
padding: 0 5px;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.uni-tab__cart-sub-right {
|
|
135
|
+
flex: 1;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.uni-tab__right {
|
|
139
|
+
margin: 5px 0;
|
|
140
|
+
margin-right: 10px;
|
|
141
|
+
border-radius: 100px;
|
|
142
|
+
overflow: hidden;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.uni-tab__cart-button-left {
|
|
146
|
+
/* #ifndef APP-NVUE */
|
|
147
|
+
display: flex;
|
|
148
|
+
/* #endif */
|
|
149
|
+
// flex: 1;
|
|
150
|
+
position: relative;
|
|
151
|
+
justify-content: center;
|
|
152
|
+
align-items: center;
|
|
153
|
+
flex-direction: column;
|
|
154
|
+
margin: 0 10px;
|
|
155
|
+
/* #ifdef H5 */
|
|
156
|
+
cursor: pointer;
|
|
157
|
+
/* #endif */
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.uni-tab__icon {
|
|
161
|
+
width: 18px;
|
|
162
|
+
height: 18px;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.image {
|
|
166
|
+
width: 18px;
|
|
167
|
+
height: 18px;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.uni-tab__text {
|
|
171
|
+
margin-top: 3px;
|
|
172
|
+
font-size: 12px;
|
|
173
|
+
color: #646566;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.uni-tab__cart-button-right {
|
|
177
|
+
/* #ifndef APP-NVUE */
|
|
178
|
+
display: flex;
|
|
179
|
+
flex-direction: column;
|
|
180
|
+
/* #endif */
|
|
181
|
+
flex: 1;
|
|
182
|
+
justify-content: center;
|
|
183
|
+
align-items: center;
|
|
184
|
+
/* #ifdef H5 */
|
|
185
|
+
cursor: pointer;
|
|
186
|
+
/* #endif */
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.uni-tab__cart-button-right-text {
|
|
190
|
+
font-size: 14px;
|
|
191
|
+
color: #fff;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.uni-tab__cart-button-right:active {
|
|
195
|
+
opacity: 0.7;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.uni-tab__dot-box {
|
|
199
|
+
/* #ifndef APP-NVUE */
|
|
200
|
+
display: flex;
|
|
201
|
+
flex-direction: column;
|
|
202
|
+
/* #endif */
|
|
203
|
+
position: absolute;
|
|
204
|
+
right: -2px;
|
|
205
|
+
top: 2px;
|
|
206
|
+
justify-content: center;
|
|
207
|
+
align-items: center;
|
|
208
|
+
// width: 0;
|
|
209
|
+
// height: 0;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.uni-tab__dot {
|
|
213
|
+
// width: 30rpx;
|
|
214
|
+
// height: 30rpx;
|
|
215
|
+
padding: 0 4px;
|
|
216
|
+
line-height: 15px;
|
|
217
|
+
color: #ffffff;
|
|
218
|
+
text-align: center;
|
|
219
|
+
font-size: 12px;
|
|
220
|
+
background-color: #ff0000;
|
|
221
|
+
border-radius: 15px;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.uni-tab__dots {
|
|
225
|
+
padding: 0 4px;
|
|
226
|
+
// width: auto;
|
|
227
|
+
border-radius: 15px;
|
|
228
|
+
}
|
|
229
|
+
</style>
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="uni-grid-wrap">
|
|
3
|
+
<view :id="elId" ref="uni-grid" class="uni-grid" :class="{ 'uni-grid--border': showBorder }" :style="{ 'border-left-color':borderColor}">
|
|
4
|
+
<slot />
|
|
5
|
+
</view>
|
|
6
|
+
</view>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script>
|
|
10
|
+
import { defineComponent } from 'vue';
|
|
11
|
+
// #ifdef APP-NVUE
|
|
12
|
+
const dom = uni.requireNativePlugin('dom');
|
|
13
|
+
// #endif
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Grid 宫格
|
|
17
|
+
* @description 宫格组件
|
|
18
|
+
* @tutorial https://ext.dcloud.net.cn/plugin?id=27
|
|
19
|
+
* @property {Number} column 每列显示个数
|
|
20
|
+
* @property {String} borderColor 边框颜色
|
|
21
|
+
* @property {Boolean} showBorder 是否显示边框
|
|
22
|
+
* @property {Boolean} square 是否方形显示
|
|
23
|
+
* @property {Boolean} Boolean 点击背景是否高亮
|
|
24
|
+
* @event {Function} change 点击 grid 触发,e={detail:{index:0}},index 为当前点击 gird 下标
|
|
25
|
+
*/
|
|
26
|
+
export default defineComponent({
|
|
27
|
+
name: 'UniGrid',
|
|
28
|
+
emits:['change'],
|
|
29
|
+
props: {
|
|
30
|
+
// 每列显示个数
|
|
31
|
+
column: {
|
|
32
|
+
type: Number,
|
|
33
|
+
default: 3
|
|
34
|
+
},
|
|
35
|
+
// 是否显示边框
|
|
36
|
+
showBorder: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
default: true
|
|
39
|
+
},
|
|
40
|
+
// 边框颜色
|
|
41
|
+
borderColor: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: '#D2D2D2'
|
|
44
|
+
},
|
|
45
|
+
// 是否正方形显示,默认为 true
|
|
46
|
+
square: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
default: true
|
|
49
|
+
},
|
|
50
|
+
highlight: {
|
|
51
|
+
type: Boolean,
|
|
52
|
+
default: true
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
provide() {
|
|
56
|
+
return {
|
|
57
|
+
grid: this
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
data() {
|
|
61
|
+
const elId = `Uni_${Math.ceil(Math.random() * 10e5).toString(36)}`
|
|
62
|
+
return {
|
|
63
|
+
elId,
|
|
64
|
+
width: 0
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
created() {
|
|
68
|
+
this.children = []
|
|
69
|
+
},
|
|
70
|
+
mounted() {
|
|
71
|
+
this.$nextTick(()=>{
|
|
72
|
+
this.init()
|
|
73
|
+
})
|
|
74
|
+
},
|
|
75
|
+
methods: {
|
|
76
|
+
init() {
|
|
77
|
+
setTimeout(() => {
|
|
78
|
+
this._getSize((width) => {
|
|
79
|
+
this.children.forEach((item, index) => {
|
|
80
|
+
item.width = width
|
|
81
|
+
})
|
|
82
|
+
})
|
|
83
|
+
}, 50)
|
|
84
|
+
},
|
|
85
|
+
change(e) {
|
|
86
|
+
this.$emit('change', e)
|
|
87
|
+
},
|
|
88
|
+
_getSize(fn) {
|
|
89
|
+
// #ifndef APP-NVUE
|
|
90
|
+
uni.createSelectorQuery()
|
|
91
|
+
.in(this)
|
|
92
|
+
.select(`#${this.elId}`)
|
|
93
|
+
.boundingClientRect()
|
|
94
|
+
.exec(ret => {
|
|
95
|
+
this.width = parseInt((ret[0].width - 1) / this.column) + 'px'
|
|
96
|
+
fn(this.width)
|
|
97
|
+
})
|
|
98
|
+
// #endif
|
|
99
|
+
// #ifdef APP-NVUE
|
|
100
|
+
dom.getComponentRect(this.$refs['uni-grid'], (ret) => {
|
|
101
|
+
this.width = parseInt((ret.size.width - 1) / this.column) + 'px'
|
|
102
|
+
fn(this.width)
|
|
103
|
+
})
|
|
104
|
+
// #endif
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
)</script>
|
|
109
|
+
|
|
110
|
+
<style lang="scss" >
|
|
111
|
+
.uni-grid-wrap {
|
|
112
|
+
/* #ifndef APP-NVUE */
|
|
113
|
+
display: flex;
|
|
114
|
+
/* #endif */
|
|
115
|
+
flex: 1;
|
|
116
|
+
flex-direction: column;
|
|
117
|
+
/* #ifdef H5 */
|
|
118
|
+
width: 100%;
|
|
119
|
+
/* #endif */
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.uni-grid {
|
|
123
|
+
/* #ifndef APP-NVUE */
|
|
124
|
+
display: flex;
|
|
125
|
+
/* #endif */
|
|
126
|
+
// flex: 1;
|
|
127
|
+
flex-direction: row;
|
|
128
|
+
flex-wrap: wrap;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.uni-grid--border {
|
|
132
|
+
position: relative;
|
|
133
|
+
/* #ifdef APP-NVUE */
|
|
134
|
+
border-left-color: #D2D2D2;
|
|
135
|
+
border-left-style: solid;
|
|
136
|
+
border-left-width: 0.5px;
|
|
137
|
+
/* #endif */
|
|
138
|
+
/* #ifndef APP-NVUE */
|
|
139
|
+
z-index: 1;
|
|
140
|
+
border-left: 1px #D2D2D2 solid;
|
|
141
|
+
/* #endif */
|
|
142
|
+
}
|
|
143
|
+
</style>
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view v-if="width" :style="'width:'+width+';'+(square?'height:'+width:'')" class="uni-grid-item">
|
|
3
|
+
<view :class="{ 'uni-grid-item--border': showBorder, 'uni-grid-item--border-top': showBorder && index < column, 'uni-highlight': highlight }"
|
|
4
|
+
:style="{'border-right-color': borderColor ,'border-bottom-color': borderColor ,'border-top-color': borderColor }"
|
|
5
|
+
class="uni-grid-item__box" @click="_onClick">
|
|
6
|
+
<slot />
|
|
7
|
+
</view>
|
|
8
|
+
</view>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script>
|
|
12
|
+
import { defineComponent } from 'vue';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* GridItem 宫格
|
|
16
|
+
* @description 宫格组件
|
|
17
|
+
* @tutorial https://ext.dcloud.net.cn/plugin?id=27
|
|
18
|
+
* @property {Number} index 子组件的唯一标识 ,点击gird会返回当前的标识
|
|
19
|
+
*/
|
|
20
|
+
export default defineComponent({
|
|
21
|
+
name: 'UniGridItem',
|
|
22
|
+
inject: ['grid'],
|
|
23
|
+
props: {
|
|
24
|
+
index: {
|
|
25
|
+
type: Number,
|
|
26
|
+
default: 0
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
data() {
|
|
30
|
+
return {
|
|
31
|
+
column: 0,
|
|
32
|
+
showBorder: true,
|
|
33
|
+
square: true,
|
|
34
|
+
highlight: true,
|
|
35
|
+
left: 0,
|
|
36
|
+
top: 0,
|
|
37
|
+
openNum: 2,
|
|
38
|
+
width: 0,
|
|
39
|
+
borderColor: '#e5e5e5'
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
created() {
|
|
43
|
+
this.column = this.grid.column
|
|
44
|
+
this.showBorder = this.grid.showBorder
|
|
45
|
+
this.square = this.grid.square
|
|
46
|
+
this.highlight = this.grid.highlight
|
|
47
|
+
this.top = this.hor === 0 ? this.grid.hor : this.hor
|
|
48
|
+
this.left = this.ver === 0 ? this.grid.ver : this.ver
|
|
49
|
+
this.borderColor = this.grid.borderColor
|
|
50
|
+
this.grid.children.push(this)
|
|
51
|
+
// this.grid.init()
|
|
52
|
+
this.width = this.grid.width
|
|
53
|
+
},
|
|
54
|
+
beforeDestroy() {
|
|
55
|
+
this.grid.children.forEach((item, index) => {
|
|
56
|
+
if (item === this) {
|
|
57
|
+
this.grid.children.splice(index, 1)
|
|
58
|
+
}
|
|
59
|
+
})
|
|
60
|
+
},
|
|
61
|
+
methods: {
|
|
62
|
+
_onClick() {
|
|
63
|
+
this.grid.change({
|
|
64
|
+
detail: {
|
|
65
|
+
index: this.index
|
|
66
|
+
}
|
|
67
|
+
})
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
)</script>
|
|
72
|
+
|
|
73
|
+
<style lang="scss" >
|
|
74
|
+
.uni-grid-item {
|
|
75
|
+
/* #ifndef APP-NVUE */
|
|
76
|
+
height: 100%;
|
|
77
|
+
display: flex;
|
|
78
|
+
/* #endif */
|
|
79
|
+
/* #ifdef H5 */
|
|
80
|
+
cursor: pointer;
|
|
81
|
+
/* #endif */
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.uni-grid-item__box {
|
|
85
|
+
/* #ifndef APP-NVUE */
|
|
86
|
+
display: flex;
|
|
87
|
+
width: 100%;
|
|
88
|
+
/* #endif */
|
|
89
|
+
position: relative;
|
|
90
|
+
flex: 1;
|
|
91
|
+
flex-direction: column;
|
|
92
|
+
// justify-content: center;
|
|
93
|
+
// align-items: center;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.uni-grid-item--border {
|
|
97
|
+
position: relative;
|
|
98
|
+
/* #ifdef APP-NVUE */
|
|
99
|
+
border-bottom-color: #D2D2D2;
|
|
100
|
+
border-bottom-style: solid;
|
|
101
|
+
border-bottom-width: 0.5px;
|
|
102
|
+
border-right-color: #D2D2D2;
|
|
103
|
+
border-right-style: solid;
|
|
104
|
+
border-right-width: 0.5px;
|
|
105
|
+
/* #endif */
|
|
106
|
+
/* #ifndef APP-NVUE */
|
|
107
|
+
z-index: 0;
|
|
108
|
+
border-bottom: 1px #D2D2D2 solid;
|
|
109
|
+
border-right: 1px #D2D2D2 solid;
|
|
110
|
+
/* #endif */
|
|
111
|
+
}
|
|
112
|
+
.uni-grid-item--border-top {
|
|
113
|
+
position: relative;
|
|
114
|
+
/* #ifdef APP-NVUE */
|
|
115
|
+
border-top-color: #D2D2D2;
|
|
116
|
+
border-top-style: solid;
|
|
117
|
+
border-top-width: 0.5px;
|
|
118
|
+
/* #endif */
|
|
119
|
+
/* #ifndef APP-NVUE */
|
|
120
|
+
border-top: 1px #D2D2D2 solid;
|
|
121
|
+
z-index: 0;
|
|
122
|
+
/* #endif */
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
.uni-highlight:active {
|
|
127
|
+
background-color: #f1f1f1;
|
|
128
|
+
}
|
|
129
|
+
</style>
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="uni-group" :class="['uni-group--'+mode ,margin?'group-margin':'']" :style="{marginTop: `${top}px` }">
|
|
3
|
+
<slot name="title">
|
|
4
|
+
<view v-if="title" class="uni-group__title" :style="{'padding-left':border?'30px':'15px'}">
|
|
5
|
+
<text class="uni-group__title-text">{{ title }}</text>
|
|
6
|
+
</view>
|
|
7
|
+
</slot>
|
|
8
|
+
<view class="uni-group__content" :class="{'group-conent-padding':border}">
|
|
9
|
+
<slot />
|
|
10
|
+
</view>
|
|
11
|
+
</view>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script>
|
|
15
|
+
/**
|
|
16
|
+
* Group 分组
|
|
17
|
+
* @description 表单字段分组
|
|
18
|
+
* @tutorial https://ext.dcloud.net.cn/plugin?id=3281
|
|
19
|
+
* @property {String} title 主标题
|
|
20
|
+
* @property {Number} top 分组间隔
|
|
21
|
+
* @property {Number} mode 模式
|
|
22
|
+
*/
|
|
23
|
+
export default {
|
|
24
|
+
name: 'uniGroup',
|
|
25
|
+
emits:['click'],
|
|
26
|
+
props: {
|
|
27
|
+
title: {
|
|
28
|
+
type: String,
|
|
29
|
+
default: ''
|
|
30
|
+
},
|
|
31
|
+
top: {
|
|
32
|
+
type: [Number, String],
|
|
33
|
+
default: 10
|
|
34
|
+
},
|
|
35
|
+
mode: {
|
|
36
|
+
type: String,
|
|
37
|
+
default: 'default'
|
|
38
|
+
},
|
|
39
|
+
stat:{
|
|
40
|
+
type: Boolean,
|
|
41
|
+
default: false
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
data() {
|
|
45
|
+
return {
|
|
46
|
+
margin: false,
|
|
47
|
+
border: false
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
watch: {
|
|
51
|
+
title(newVal) {
|
|
52
|
+
if (uni.report && this.stat && newVal !== '') {
|
|
53
|
+
uni.report('title', newVal)
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
created() {
|
|
58
|
+
this.form = this.getForm()
|
|
59
|
+
if (this.form) {
|
|
60
|
+
this.margin = true
|
|
61
|
+
this.border = this.form.border
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
methods: {
|
|
65
|
+
/**
|
|
66
|
+
* 获取父元素实例
|
|
67
|
+
*/
|
|
68
|
+
getForm() {
|
|
69
|
+
let parent = this.$parent;
|
|
70
|
+
let parentName = parent.$options.name;
|
|
71
|
+
while (parentName !== 'uniForms') {
|
|
72
|
+
parent = parent.$parent;
|
|
73
|
+
if (!parent) return false
|
|
74
|
+
parentName = parent.$options.name;
|
|
75
|
+
}
|
|
76
|
+
return parent;
|
|
77
|
+
},
|
|
78
|
+
onClick() {
|
|
79
|
+
this.$emit('click')
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
</script>
|
|
84
|
+
<style lang="scss" >
|
|
85
|
+
.uni-group {
|
|
86
|
+
background: #fff;
|
|
87
|
+
margin-top: 10px;
|
|
88
|
+
// border: 1px red solid;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.group-margin {
|
|
92
|
+
// margin: 0 -15px;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.uni-group__title {
|
|
96
|
+
/* #ifndef APP-NVUE */
|
|
97
|
+
display: flex;
|
|
98
|
+
/* #endif */
|
|
99
|
+
flex-direction: row;
|
|
100
|
+
align-items: center;
|
|
101
|
+
padding-left: 15px;
|
|
102
|
+
height: 40px;
|
|
103
|
+
background-color: #eee;
|
|
104
|
+
font-weight: normal;
|
|
105
|
+
color: #666;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.uni-group__content {
|
|
109
|
+
padding: 15px;
|
|
110
|
+
// padding-bottom: 5px;
|
|
111
|
+
// background-color: #FFF;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.group-conent-padding {
|
|
115
|
+
padding: 0 15px;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.uni-group__title-text {
|
|
119
|
+
font-size: 14px;
|
|
120
|
+
color: #666;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.distraction {
|
|
124
|
+
flex-direction: row;
|
|
125
|
+
align-items: center;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.uni-group--card {
|
|
129
|
+
margin: 10px;
|
|
130
|
+
border-radius: 5px;
|
|
131
|
+
overflow: hidden;
|
|
132
|
+
box-shadow: 0 0 5px 1px rgba($color: #000000, $alpha: 0.08);
|
|
133
|
+
}
|
|
134
|
+
</style>
|