@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,534 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!-- #ifdef APP-NVUE -->
|
|
3
|
+
<cell :keep-scroll-position="keepScrollPosition">
|
|
4
|
+
<!-- #endif -->
|
|
5
|
+
<view :class="{ 'uni-list-item--disabled': disabled }" :style="{'background-color':customStyle.backgroundColor}"
|
|
6
|
+
:hover-class="(!clickable && !link) || disabled || showSwitch ? '' : 'uni-list-item--hover'"
|
|
7
|
+
class="uni-list-item" @click="onClick">
|
|
8
|
+
<view v-if="!isFirstChild" class="border--left" :class="{ 'uni-list--border': border }"></view>
|
|
9
|
+
<view class="uni-list-item__container"
|
|
10
|
+
:class="{ 'container--right': showArrow || link, 'flex--direction': direction === 'column'}"
|
|
11
|
+
:style="{paddingTop:padding.top,paddingLeft:padding.left,paddingRight:padding.right,paddingBottom:padding.bottom}">
|
|
12
|
+
<slot name="header">
|
|
13
|
+
<view class="uni-list-item__header">
|
|
14
|
+
<view v-if="thumb" class="uni-list-item__icon">
|
|
15
|
+
<image :src="thumb" class="uni-list-item__icon-img" :class="['uni-list--' + thumbSize]" />
|
|
16
|
+
</view>
|
|
17
|
+
<view v-else-if="showExtraIcon" class="uni-list-item__icon">
|
|
18
|
+
<uni-icons :customPrefix="extraIcon.customPrefix" :color="extraIcon.color" :size="extraIcon.size" :type="extraIcon.type" />
|
|
19
|
+
</view>
|
|
20
|
+
</view>
|
|
21
|
+
</slot>
|
|
22
|
+
<slot name="body">
|
|
23
|
+
<view class="uni-list-item__content"
|
|
24
|
+
:class="{ 'uni-list-item__content--center': thumb || showExtraIcon || showBadge || showSwitch }">
|
|
25
|
+
<text v-if="title" class="uni-list-item__content-title"
|
|
26
|
+
:class="[ellipsis !== 0 && ellipsis <= 2 ? 'uni-ellipsis-' + ellipsis : '']">{{ title }}</text>
|
|
27
|
+
<text v-if="note" class="uni-list-item__content-note">{{ note }}</text>
|
|
28
|
+
</view>
|
|
29
|
+
</slot>
|
|
30
|
+
<slot name="footer">
|
|
31
|
+
<view v-if="rightText || showBadge || showSwitch" class="uni-list-item__extra"
|
|
32
|
+
:class="{ 'flex--justify': direction === 'column' }">
|
|
33
|
+
<text v-if="rightText" class="uni-list-item__extra-text">{{ rightText }}</text>
|
|
34
|
+
<uni-badge v-if="showBadge" :type="badgeType" :text="badgeText" :custom-style="badgeStyle" />
|
|
35
|
+
<switch v-if="showSwitch" :disabled="disabled" :checked="switchChecked"
|
|
36
|
+
@change="onSwitchChange" />
|
|
37
|
+
</view>
|
|
38
|
+
</slot>
|
|
39
|
+
</view>
|
|
40
|
+
<uni-icons v-if="showArrow || link" :size="16" class="uni-icon-wrapper" color="#bbb" type="arrowright" />
|
|
41
|
+
</view>
|
|
42
|
+
<!-- #ifdef APP-NVUE -->
|
|
43
|
+
</cell>
|
|
44
|
+
<!-- #endif -->
|
|
45
|
+
</template>
|
|
46
|
+
|
|
47
|
+
<script>
|
|
48
|
+
/**
|
|
49
|
+
* ListItem 列表子组件
|
|
50
|
+
* @description 列表子组件
|
|
51
|
+
* @tutorial https://ext.dcloud.net.cn/plugin?id=24
|
|
52
|
+
* @property {String} title 标题
|
|
53
|
+
* @property {String} note 描述
|
|
54
|
+
* @property {String} thumb 左侧缩略图,若thumb有值,则不会显示扩展图标
|
|
55
|
+
* @property {String} thumbSize = [lg|base|sm] 略缩图大小
|
|
56
|
+
* @value lg 大图
|
|
57
|
+
* @value base 一般
|
|
58
|
+
* @value sm 小图
|
|
59
|
+
* @property {String} badgeText 数字角标内容
|
|
60
|
+
* @property {String} badgeType 数字角标类型,参考[uni-icons](https://ext.dcloud.net.cn/plugin?id=21)
|
|
61
|
+
* @property {Object} badgeStyle 数字角标样式
|
|
62
|
+
* @property {String} rightText 右侧文字内容
|
|
63
|
+
* @property {Boolean} disabled = [true|false] 是否禁用
|
|
64
|
+
* @property {Boolean} clickable = [true|false] 是否开启点击反馈
|
|
65
|
+
* @property {String} link = [navigateTo|redirectTo|reLaunch|switchTab] 是否展示右侧箭头并开启点击反馈
|
|
66
|
+
* @value navigateTo 同 uni.navigateTo()
|
|
67
|
+
* @value redirectTo 同 uni.redirectTo()
|
|
68
|
+
* @value reLaunch 同 uni.reLaunch()
|
|
69
|
+
* @value switchTab 同 uni.switchTab()
|
|
70
|
+
* @property {String | PageURIString} to 跳转目标页面
|
|
71
|
+
* @property {Boolean} showBadge = [true|false] 是否显示数字角标
|
|
72
|
+
* @property {Boolean} showSwitch = [true|false] 是否显示Switch
|
|
73
|
+
* @property {Boolean} switchChecked = [true|false] Switch是否被选中
|
|
74
|
+
* @property {Boolean} showExtraIcon = [true|false] 左侧是否显示扩展图标
|
|
75
|
+
* @property {Object} extraIcon 扩展图标参数,格式为 {color: '#4cd964',size: '22',type: 'spinner'}
|
|
76
|
+
* @property {String} direction = [row|column] 排版方向
|
|
77
|
+
* @value row 水平排列
|
|
78
|
+
* @value column 垂直排列
|
|
79
|
+
* @event {Function} click 点击 uniListItem 触发事件
|
|
80
|
+
* @event {Function} switchChange 点击切换 Switch 时触发
|
|
81
|
+
*/
|
|
82
|
+
export default {
|
|
83
|
+
name: 'UniListItem',
|
|
84
|
+
emits: ['click', 'switchChange'],
|
|
85
|
+
props: {
|
|
86
|
+
direction: {
|
|
87
|
+
type: String,
|
|
88
|
+
default: 'row'
|
|
89
|
+
},
|
|
90
|
+
title: {
|
|
91
|
+
type: String,
|
|
92
|
+
default: ''
|
|
93
|
+
},
|
|
94
|
+
note: {
|
|
95
|
+
type: String,
|
|
96
|
+
default: ''
|
|
97
|
+
},
|
|
98
|
+
ellipsis: {
|
|
99
|
+
type: [Number, String],
|
|
100
|
+
default: 0
|
|
101
|
+
},
|
|
102
|
+
disabled: {
|
|
103
|
+
type: [Boolean, String],
|
|
104
|
+
default: false
|
|
105
|
+
},
|
|
106
|
+
clickable: {
|
|
107
|
+
type: Boolean,
|
|
108
|
+
default: false
|
|
109
|
+
},
|
|
110
|
+
showArrow: {
|
|
111
|
+
type: [Boolean, String],
|
|
112
|
+
default: false
|
|
113
|
+
},
|
|
114
|
+
link: {
|
|
115
|
+
type: [Boolean, String],
|
|
116
|
+
default: false
|
|
117
|
+
},
|
|
118
|
+
to: {
|
|
119
|
+
type: String,
|
|
120
|
+
default: ''
|
|
121
|
+
},
|
|
122
|
+
showBadge: {
|
|
123
|
+
type: [Boolean, String],
|
|
124
|
+
default: false
|
|
125
|
+
},
|
|
126
|
+
showSwitch: {
|
|
127
|
+
type: [Boolean, String],
|
|
128
|
+
default: false
|
|
129
|
+
},
|
|
130
|
+
switchChecked: {
|
|
131
|
+
type: [Boolean, String],
|
|
132
|
+
default: false
|
|
133
|
+
},
|
|
134
|
+
badgeText: {
|
|
135
|
+
type: String,
|
|
136
|
+
default: ''
|
|
137
|
+
},
|
|
138
|
+
badgeType: {
|
|
139
|
+
type: String,
|
|
140
|
+
default: 'success'
|
|
141
|
+
},
|
|
142
|
+
badgeStyle: {
|
|
143
|
+
type: Object,
|
|
144
|
+
default () {
|
|
145
|
+
return {}
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
rightText: {
|
|
149
|
+
type: String,
|
|
150
|
+
default: ''
|
|
151
|
+
},
|
|
152
|
+
thumb: {
|
|
153
|
+
type: String,
|
|
154
|
+
default: ''
|
|
155
|
+
},
|
|
156
|
+
thumbSize: {
|
|
157
|
+
type: String,
|
|
158
|
+
default: 'base'
|
|
159
|
+
},
|
|
160
|
+
showExtraIcon: {
|
|
161
|
+
type: [Boolean, String],
|
|
162
|
+
default: false
|
|
163
|
+
},
|
|
164
|
+
extraIcon: {
|
|
165
|
+
type: Object,
|
|
166
|
+
default () {
|
|
167
|
+
return {
|
|
168
|
+
type: '',
|
|
169
|
+
color: '#000000',
|
|
170
|
+
size: 20,
|
|
171
|
+
customPrefix: ''
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
border: {
|
|
176
|
+
type: Boolean,
|
|
177
|
+
default: true
|
|
178
|
+
},
|
|
179
|
+
customStyle: {
|
|
180
|
+
type: Object,
|
|
181
|
+
default () {
|
|
182
|
+
return {
|
|
183
|
+
padding: '',
|
|
184
|
+
backgroundColor: '#FFFFFF'
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
keepScrollPosition: {
|
|
189
|
+
type: Boolean,
|
|
190
|
+
default: false
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
watch: {
|
|
194
|
+
'customStyle.padding': {
|
|
195
|
+
handler(padding) {
|
|
196
|
+
if(typeof padding == 'number'){
|
|
197
|
+
padding += ''
|
|
198
|
+
}
|
|
199
|
+
let paddingArr = padding.split(' ')
|
|
200
|
+
if (paddingArr.length === 1) {
|
|
201
|
+
const allPadding = paddingArr[0]
|
|
202
|
+
this.padding = {
|
|
203
|
+
"top": allPadding,
|
|
204
|
+
"right": allPadding,
|
|
205
|
+
"bottom": allPadding,
|
|
206
|
+
"left": allPadding
|
|
207
|
+
}
|
|
208
|
+
} else if (paddingArr.length === 2) {
|
|
209
|
+
const [verticalPadding, horizontalPadding] = paddingArr;
|
|
210
|
+
this.padding = {
|
|
211
|
+
"top": verticalPadding,
|
|
212
|
+
"right": horizontalPadding,
|
|
213
|
+
"bottom": verticalPadding,
|
|
214
|
+
"left": horizontalPadding
|
|
215
|
+
}
|
|
216
|
+
} else if (paddingArr.length === 4) {
|
|
217
|
+
const [topPadding, rightPadding, bottomPadding, leftPadding] = paddingArr;
|
|
218
|
+
this.padding = {
|
|
219
|
+
"top": topPadding,
|
|
220
|
+
"right": rightPadding,
|
|
221
|
+
"bottom": bottomPadding,
|
|
222
|
+
"left": leftPadding
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
},
|
|
226
|
+
immediate: true
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
// inject: ['list'],
|
|
230
|
+
data() {
|
|
231
|
+
return {
|
|
232
|
+
isFirstChild: false,
|
|
233
|
+
padding: {
|
|
234
|
+
top: "",
|
|
235
|
+
right: "",
|
|
236
|
+
bottom: "",
|
|
237
|
+
left: ""
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
},
|
|
241
|
+
mounted() {
|
|
242
|
+
this.list = this.getForm()
|
|
243
|
+
// 判断是否存在 uni-list 组件
|
|
244
|
+
if (this.list) {
|
|
245
|
+
if (!this.list.firstChildAppend) {
|
|
246
|
+
this.list.firstChildAppend = true;
|
|
247
|
+
this.isFirstChild = true;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
},
|
|
251
|
+
methods: {
|
|
252
|
+
/**
|
|
253
|
+
* 获取父元素实例
|
|
254
|
+
*/
|
|
255
|
+
getForm(name = 'uniList') {
|
|
256
|
+
let parent = this.$parent;
|
|
257
|
+
let parentName = parent.$options.name;
|
|
258
|
+
while (parentName !== name) {
|
|
259
|
+
parent = parent.$parent;
|
|
260
|
+
if (!parent) return false
|
|
261
|
+
parentName = parent.$options.name;
|
|
262
|
+
}
|
|
263
|
+
return parent;
|
|
264
|
+
},
|
|
265
|
+
onClick() {
|
|
266
|
+
if (this.to !== '') {
|
|
267
|
+
this.openPage();
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
if (this.clickable || this.link) {
|
|
271
|
+
this.$emit('click', {
|
|
272
|
+
data: {}
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
},
|
|
276
|
+
onSwitchChange(e) {
|
|
277
|
+
this.$emit('switchChange', e.detail);
|
|
278
|
+
},
|
|
279
|
+
openPage() {
|
|
280
|
+
if (['navigateTo', 'redirectTo', 'reLaunch', 'switchTab'].indexOf(this.link) !== -1) {
|
|
281
|
+
this.pageApi(this.link);
|
|
282
|
+
} else {
|
|
283
|
+
this.pageApi('navigateTo');
|
|
284
|
+
}
|
|
285
|
+
},
|
|
286
|
+
pageApi(api) {
|
|
287
|
+
let callback = {
|
|
288
|
+
url: this.to,
|
|
289
|
+
success: res => {
|
|
290
|
+
this.$emit('click', {
|
|
291
|
+
data: res
|
|
292
|
+
});
|
|
293
|
+
},
|
|
294
|
+
fail: err => {
|
|
295
|
+
this.$emit('click', {
|
|
296
|
+
data: err
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
switch (api) {
|
|
301
|
+
case 'navigateTo':
|
|
302
|
+
uni.navigateTo(callback)
|
|
303
|
+
break
|
|
304
|
+
case 'redirectTo':
|
|
305
|
+
uni.redirectTo(callback)
|
|
306
|
+
break
|
|
307
|
+
case 'reLaunch':
|
|
308
|
+
uni.reLaunch(callback)
|
|
309
|
+
break
|
|
310
|
+
case 'switchTab':
|
|
311
|
+
uni.switchTab(callback)
|
|
312
|
+
break
|
|
313
|
+
default:
|
|
314
|
+
uni.navigateTo(callback)
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
};
|
|
319
|
+
</script>
|
|
320
|
+
|
|
321
|
+
<style lang="scss">
|
|
322
|
+
$uni-font-size-sm:12px;
|
|
323
|
+
$uni-font-size-base:14px;
|
|
324
|
+
$uni-font-size-lg:16px;
|
|
325
|
+
$uni-spacing-col-lg: 12px;
|
|
326
|
+
$uni-spacing-row-lg: 15px;
|
|
327
|
+
$uni-img-size-sm:20px;
|
|
328
|
+
$uni-img-size-base:26px;
|
|
329
|
+
$uni-img-size-lg:40px;
|
|
330
|
+
$uni-border-color:#e5e5e5;
|
|
331
|
+
$uni-bg-color-hover:#f1f1f1;
|
|
332
|
+
$uni-text-color-grey:#999;
|
|
333
|
+
$list-item-pd: $uni-spacing-col-lg $uni-spacing-row-lg;
|
|
334
|
+
|
|
335
|
+
.uni-list-item {
|
|
336
|
+
/* #ifndef APP-NVUE */
|
|
337
|
+
display: flex;
|
|
338
|
+
/* #endif */
|
|
339
|
+
font-size: $uni-font-size-lg;
|
|
340
|
+
position: relative;
|
|
341
|
+
justify-content: space-between;
|
|
342
|
+
align-items: center;
|
|
343
|
+
background-color: #fff;
|
|
344
|
+
flex-direction: row;
|
|
345
|
+
/* #ifdef H5 */
|
|
346
|
+
cursor: pointer;
|
|
347
|
+
/* #endif */
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
.uni-list-item--disabled {
|
|
351
|
+
opacity: 0.3;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
.uni-list-item--hover {
|
|
355
|
+
background-color: $uni-bg-color-hover !important;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
.uni-list-item__container {
|
|
359
|
+
position: relative;
|
|
360
|
+
/* #ifndef APP-NVUE */
|
|
361
|
+
display: flex;
|
|
362
|
+
/* #endif */
|
|
363
|
+
flex-direction: row;
|
|
364
|
+
padding: $list-item-pd;
|
|
365
|
+
padding-left: $uni-spacing-row-lg;
|
|
366
|
+
flex: 1;
|
|
367
|
+
overflow: hidden;
|
|
368
|
+
// align-items: center;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
.container--right {
|
|
372
|
+
padding-right: 0;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
// .border--left {
|
|
376
|
+
// margin-left: $uni-spacing-row-lg;
|
|
377
|
+
// }
|
|
378
|
+
.uni-list--border {
|
|
379
|
+
position: absolute;
|
|
380
|
+
top: 0;
|
|
381
|
+
right: 0;
|
|
382
|
+
left: 0;
|
|
383
|
+
/* #ifdef APP-NVUE */
|
|
384
|
+
border-top-color: $uni-border-color;
|
|
385
|
+
border-top-style: solid;
|
|
386
|
+
border-top-width: 0.5px;
|
|
387
|
+
/* #endif */
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
/* #ifndef APP-NVUE */
|
|
391
|
+
.uni-list--border:after {
|
|
392
|
+
position: absolute;
|
|
393
|
+
top: 0;
|
|
394
|
+
right: 0;
|
|
395
|
+
left: 0;
|
|
396
|
+
height: 1px;
|
|
397
|
+
content: '';
|
|
398
|
+
-webkit-transform: scaleY(0.5);
|
|
399
|
+
transform: scaleY(0.5);
|
|
400
|
+
background-color: $uni-border-color;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
/* #endif */
|
|
404
|
+
.uni-list-item__content {
|
|
405
|
+
/* #ifndef APP-NVUE */
|
|
406
|
+
display: flex;
|
|
407
|
+
/* #endif */
|
|
408
|
+
padding-right: 8px;
|
|
409
|
+
flex: 1;
|
|
410
|
+
color: #3b4144;
|
|
411
|
+
// overflow: hidden;
|
|
412
|
+
flex-direction: column;
|
|
413
|
+
justify-content: space-between;
|
|
414
|
+
overflow: hidden;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
.uni-list-item__content--center {
|
|
418
|
+
justify-content: center;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
.uni-list-item__content-title {
|
|
422
|
+
font-size: $uni-font-size-base;
|
|
423
|
+
color: #3b4144;
|
|
424
|
+
overflow: hidden;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
.uni-list-item__content-note {
|
|
428
|
+
margin-top: 6rpx;
|
|
429
|
+
color: $uni-text-color-grey;
|
|
430
|
+
font-size: $uni-font-size-sm;
|
|
431
|
+
overflow: hidden;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
.uni-list-item__extra {
|
|
435
|
+
// width: 25%;
|
|
436
|
+
/* #ifndef APP-NVUE */
|
|
437
|
+
display: flex;
|
|
438
|
+
/* #endif */
|
|
439
|
+
flex-direction: row;
|
|
440
|
+
justify-content: flex-end;
|
|
441
|
+
align-items: center;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
.uni-list-item__header {
|
|
445
|
+
/* #ifndef APP-NVUE */
|
|
446
|
+
display: flex;
|
|
447
|
+
/* #endif */
|
|
448
|
+
flex-direction: row;
|
|
449
|
+
align-items: center;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
.uni-list-item__icon {
|
|
453
|
+
margin-right: 18rpx;
|
|
454
|
+
flex-direction: row;
|
|
455
|
+
justify-content: center;
|
|
456
|
+
align-items: center;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
.uni-list-item__icon-img {
|
|
460
|
+
/* #ifndef APP-NVUE */
|
|
461
|
+
display: block;
|
|
462
|
+
/* #endif */
|
|
463
|
+
height: $uni-img-size-base;
|
|
464
|
+
width: $uni-img-size-base;
|
|
465
|
+
margin-right: 10px;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
.uni-icon-wrapper {
|
|
469
|
+
/* #ifndef APP-NVUE */
|
|
470
|
+
display: flex;
|
|
471
|
+
/* #endif */
|
|
472
|
+
align-items: center;
|
|
473
|
+
padding: 0 10px;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
.flex--direction {
|
|
477
|
+
flex-direction: column;
|
|
478
|
+
/* #ifndef APP-NVUE */
|
|
479
|
+
align-items: initial;
|
|
480
|
+
/* #endif */
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
.flex--justify {
|
|
484
|
+
/* #ifndef APP-NVUE */
|
|
485
|
+
justify-content: initial;
|
|
486
|
+
/* #endif */
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
.uni-list--lg {
|
|
490
|
+
height: $uni-img-size-lg;
|
|
491
|
+
width: $uni-img-size-lg;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
.uni-list--base {
|
|
495
|
+
height: $uni-img-size-base;
|
|
496
|
+
width: $uni-img-size-base;
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
.uni-list--sm {
|
|
500
|
+
height: $uni-img-size-sm;
|
|
501
|
+
width: $uni-img-size-sm;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
.uni-list-item__extra-text {
|
|
505
|
+
color: $uni-text-color-grey;
|
|
506
|
+
font-size: $uni-font-size-sm;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
.uni-ellipsis-1 {
|
|
510
|
+
/* #ifndef APP-NVUE */
|
|
511
|
+
overflow: hidden;
|
|
512
|
+
white-space: nowrap;
|
|
513
|
+
text-overflow: ellipsis;
|
|
514
|
+
/* #endif */
|
|
515
|
+
/* #ifdef APP-NVUE */
|
|
516
|
+
lines: 1;
|
|
517
|
+
text-overflow: ellipsis;
|
|
518
|
+
/* #endif */
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
.uni-ellipsis-2 {
|
|
522
|
+
/* #ifndef APP-NVUE */
|
|
523
|
+
overflow: hidden;
|
|
524
|
+
text-overflow: ellipsis;
|
|
525
|
+
display: -webkit-box;
|
|
526
|
+
-webkit-line-clamp: 2;
|
|
527
|
+
-webkit-box-orient: vertical;
|
|
528
|
+
/* #endif */
|
|
529
|
+
/* #ifdef APP-NVUE */
|
|
530
|
+
lines: 2;
|
|
531
|
+
text-overflow: ellipsis;
|
|
532
|
+
/* #endif */
|
|
533
|
+
}
|
|
534
|
+
</style>
|