@10yun/cv-mobile-ui 0.5.20 → 0.5.22

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.
Files changed (71) hide show
  1. package/package.json +1 -1
  2. package/plugins/jumps.js +57 -12
  3. package/plugins/lbs.js +17 -8
  4. package/ui-cv/components/cv-grid-item/cv-grid-item.vue +1 -1
  5. package/uni-ui/lib/uni-badge/uni-badge.vue +150 -1
  6. package/uni-ui/lib/uni-breadcrumb/uni-breadcrumb.vue +37 -1
  7. package/uni-ui/lib/uni-breadcrumb-item/uni-breadcrumb-item.vue +83 -1
  8. package/uni-ui/lib/uni-calendar/uni-calendar-item.vue +122 -1
  9. package/uni-ui/lib/uni-calendar/uni-calendar.vue +366 -1
  10. package/uni-ui/lib/uni-card/uni-card.vue +124 -1
  11. package/uni-ui/lib/uni-col/uni-col.vue +1 -1
  12. package/uni-ui/lib/uni-collapse/uni-collapse.vue +135 -1
  13. package/uni-ui/lib/uni-collapse-item/uni-collapse-item.vue +266 -1
  14. package/uni-ui/lib/uni-combox/uni-combox.vue +1 -1
  15. package/uni-ui/lib/uni-countdown/uni-countdown.vue +239 -1
  16. package/uni-ui/lib/uni-data-checkbox/uni-data-checkbox.vue +487 -1
  17. package/uni-ui/lib/uni-data-picker/uni-data-picker.vue +530 -1
  18. package/uni-ui/lib/uni-data-pickerview/uni-data-picker.js +157 -150
  19. package/uni-ui/lib/uni-data-pickerview/uni-data-pickerview.vue +166 -1
  20. package/uni-ui/lib/uni-data-select/uni-data-select.vue +289 -1
  21. package/uni-ui/lib/uni-datetime-picker/calendar-item.vue +70 -1
  22. package/uni-ui/lib/uni-datetime-picker/calendar.vue +629 -1
  23. package/uni-ui/lib/uni-datetime-picker/time-picker.vue +741 -1
  24. package/uni-ui/lib/uni-datetime-picker/uni-datetime-picker.vue +847 -1
  25. package/uni-ui/lib/uni-drawer/uni-drawer.vue +115 -1
  26. package/uni-ui/lib/uni-easyinput/uni-easyinput.vue +515 -1
  27. package/uni-ui/lib/uni-fab/uni-fab.vue +257 -1
  28. package/uni-ui/lib/uni-fav/uni-fav.vue +123 -1
  29. package/uni-ui/lib/uni-file-picker/uni-file-picker.vue +642 -1
  30. package/uni-ui/lib/uni-file-picker/upload-file.vue +177 -1
  31. package/uni-ui/lib/uni-file-picker/upload-image.vue +176 -1
  32. package/uni-ui/lib/uni-forms/uni-forms.vue +375 -1
  33. package/uni-ui/lib/uni-forms-item/uni-forms-item.vue +429 -1
  34. package/uni-ui/lib/uni-goods-nav/uni-goods-nav.vue +129 -1
  35. package/uni-ui/lib/uni-grid/uni-grid.vue +115 -1
  36. package/uni-ui/lib/uni-grid-item/uni-grid-item.vue +78 -1
  37. package/uni-ui/lib/uni-group/uni-group.vue +85 -1
  38. package/uni-ui/lib/uni-icons/uni-icons.vue +85 -1
  39. package/uni-ui/lib/uni-indexed-list/uni-indexed-list-item.vue +68 -1
  40. package/uni-ui/lib/uni-indexed-list/uni-indexed-list.vue +294 -1
  41. package/uni-ui/lib/uni-list/uni-list.vue +81 -1
  42. package/uni-ui/lib/uni-list-ad/uni-list-ad.vue +77 -1
  43. package/uni-ui/lib/uni-list-chat/uni-list-chat.vue +294 -1
  44. package/uni-ui/lib/uni-list-item/uni-list-item.vue +346 -1
  45. package/uni-ui/lib/uni-load-more/uni-load-more.vue +172 -1
  46. package/uni-ui/lib/uni-nav-bar/uni-nav-bar.vue +205 -1
  47. package/uni-ui/lib/uni-nav-bar/uni-status-bar.vue +18 -1
  48. package/uni-ui/lib/uni-notice-bar/uni-notice-bar.vue +331 -1
  49. package/uni-ui/lib/uni-number-box/uni-number-box.vue +166 -1
  50. package/uni-ui/lib/uni-pagination/uni-pagination.vue +323 -1
  51. package/uni-ui/lib/uni-popup/uni-popup.vue +1 -1
  52. package/uni-ui/lib/uni-popup-dialog/uni-popup-dialog.vue +173 -1
  53. package/uni-ui/lib/uni-popup-message/uni-popup-message.vue +74 -1
  54. package/uni-ui/lib/uni-popup-share/uni-popup-share.vue +106 -1
  55. package/uni-ui/lib/uni-rate/uni-rate.vue +322 -1
  56. package/uni-ui/lib/uni-row/uni-row.vue +1 -1
  57. package/uni-ui/lib/uni-search-bar/uni-search-bar.vue +236 -1
  58. package/uni-ui/lib/uni-section/uni-section.vue +109 -1
  59. package/uni-ui/lib/uni-segmented-control/uni-segmented-control.vue +103 -1
  60. package/uni-ui/lib/uni-status-bar/uni-status-bar.vue +1 -1
  61. package/uni-ui/lib/uni-steps/uni-steps.vue +120 -1
  62. package/uni-ui/lib/uni-swipe-action-item/uni-swipe-action-item.vue +226 -3
  63. package/uni-ui/lib/uni-swiper-dot/uni-swiper-dot.vue +167 -1
  64. package/uni-ui/lib/uni-table/uni-table.vue +297 -1
  65. package/uni-ui/lib/uni-tag/uni-tag.vue +100 -1
  66. package/uni-ui/lib/uni-td/uni-td.vue +78 -1
  67. package/uni-ui/lib/uni-th/filter-dropdown.vue +1 -1
  68. package/uni-ui/lib/uni-th/uni-th.vue +224 -1
  69. package/uni-ui/lib/uni-thead/uni-thead.vue +77 -1
  70. package/uni-ui/lib/uni-tr/table-checkbox.vue +79 -1
  71. package/uni-ui/lib/uni-tr/uni-tr.vue +135 -1
@@ -1 +1,129 @@
1
- <template>
2
1
  <view class="uni-goods-nav">
3
2
  <!-- 底部占位 -->
4
3
  <view class="uni-tab__seat" />
5
4
  <view class="uni-tab__cart-box flex">
6
5
  <view class="flex uni-tab__cart-sub-left">
7
6
  <view
8
7
  v-for="(item, index) in options"
9
8
  :key="index"
10
9
  class="flex uni-tab__cart-button-left uni-tab__shop-cart"
11
10
  @click="onClick(index, item)"
12
11
  >
13
12
  <view class="uni-tab__icon">
14
13
  <uni-icons :type="item.icon" size="20" color="#646566"></uni-icons>
15
14
  <!-- <image class="image" :src="item.icon" mode="widthFix" /> -->
16
15
  </view>
17
16
  <text class="uni-tab__text">{{ item.text }}</text>
18
17
  <view class="flex uni-tab__dot-box">
19
18
  <text
20
19
  v-if="item.info"
21
20
  :class="{ 'uni-tab__dots': item.info > 9 }"
22
21
  class="uni-tab__dot"
23
22
  :style="{
24
23
  backgroundColor: item.infoBackgroundColor ? item.infoBackgroundColor : '#ff0000',
25
24
  color: item.infoColor ? item.infoColor : '#fff'
26
25
  }"
27
26
  >
28
27
  {{ item.info }}
29
28
  </text>
30
29
  </view>
31
30
  </view>
32
31
  </view>
33
32
  <view :class="{ 'uni-tab__right': fill }" class="flex uni-tab__cart-sub-right">
34
33
  <view
35
34
  v-for="(item, index) in buttonGroup"
36
35
  :key="index"
37
36
  :style="{ background: item.backgroundColor, color: item.color }"
38
37
  class="flex uni-tab__cart-button-right"
39
38
  @click="buttonClick(index, item)"
40
39
  >
41
40
  <text :style="{ color: item.color }" class="uni-tab__cart-button-right-text">{{ item.text }}</text>
42
41
  </view>
43
42
  </view>
44
43
  </view>
45
44
  </view>
46
45
  * GoodsNav 商品导航
47
46
  * @description 商品加入购物车、立即购买等
48
47
  * @tutorial https://ext.dcloud.net.cn/plugin?id=865
49
48
  * @property {Array} options 组件参数
50
49
  * @property {Array} buttonGroup 组件按钮组参数
51
50
  * @property {Boolean} fill = [true | false] 组件按钮组参数
52
51
  * @property {Boolean} stat 是否开启统计功能
53
52
  * @event {Function} click 左侧点击事件
54
53
  * @event {Function} buttonClick 右侧按钮组点击事件
55
54
  * @example <uni-goods-nav :fill="true" options="" buttonGroup="buttonGroup" @click="" @buttonClick="" />
56
55
  */
57
56
  name: 'UniGoodsNav',
58
57
  emits: ['click', 'buttonClick'],
59
58
  props: {
60
59
  options: {
61
60
  type: Array,
62
61
  default() {
63
62
  return [
64
63
  {
65
64
  icon: 'shop',
66
65
  text: t('uni-goods-nav.options.shop')
67
66
  },
68
67
  {
69
68
  icon: 'cart',
70
69
  text: t('uni-goods-nav.options.cart')
71
70
  }
72
71
  ];
73
72
  }
74
73
  },
75
74
  buttonGroup: {
76
75
  type: Array,
77
76
  default() {
78
77
  return [
79
78
  {
80
79
  text: t('uni-goods-nav.buttonGroup.addToCart'),
81
80
  backgroundColor: 'linear-gradient(90deg, #FFCD1E, #FF8A18)',
82
81
  color: '#fff'
83
82
  },
84
83
  {
85
84
  text: t('uni-goods-nav.buttonGroup.buyNow'),
86
85
  backgroundColor: 'linear-gradient(90deg, #FE6035, #EF1224)',
87
86
  color: '#fff'
88
87
  }
89
88
  ];
90
89
  }
91
90
  },
92
91
  fill: {
93
92
  type: Boolean,
94
93
  default: false
95
94
  },
96
95
  stat: {
97
96
  type: Boolean,
98
97
  default: false
99
98
  }
100
99
  },
101
100
  methods: {
102
101
  onClick(index, item) {
103
102
  this.$emit('click', {
104
103
  index,
105
104
  content: item
106
105
  });
107
106
  },
108
107
  buttonClick(index, item) {
109
108
  if (uni.report && this.stat) {
110
109
  uni.report(item.text, item.text);
111
110
  }
112
111
  this.$emit('buttonClick', {
113
112
  index,
114
113
  content: item
115
114
  });
116
115
  }
117
116
  }
117
+ <template>
118
+ <view class="uni-goods-nav">
119
+ <!-- 底部占位 -->
120
+ <view class="uni-tab__seat" />
121
+ <view class="uni-tab__cart-box flex">
122
+ <view class="flex uni-tab__cart-sub-left">
123
+ <view
124
+ v-for="(item, index) in options"
125
+ :key="index"
126
+ class="flex uni-tab__cart-button-left uni-tab__shop-cart"
127
+ @click="onClick(index, item)"
128
+ >
129
+ <view class="uni-tab__icon">
130
+ <uni-icons :type="item.icon" size="20" color="#646566"></uni-icons>
131
+ <!-- <image class="image" :src="item.icon" mode="widthFix" /> -->
132
+ </view>
133
+ <text class="uni-tab__text">{{ item.text }}</text>
134
+ <view class="flex uni-tab__dot-box">
135
+ <text
136
+ v-if="item.info"
137
+ :class="{ 'uni-tab__dots': item.info > 9 }"
138
+ class="uni-tab__dot"
139
+ :style="{
140
+ backgroundColor: item.infoBackgroundColor ? item.infoBackgroundColor : '#ff0000',
141
+ color: item.infoColor ? item.infoColor : '#fff'
142
+ }"
143
+ >
144
+ {{ item.info }}
145
+ </text>
146
+ </view>
147
+ </view>
148
+ </view>
149
+ <view :class="{ 'uni-tab__right': fill }" class="flex uni-tab__cart-sub-right">
150
+ <view
151
+ v-for="(item, index) in buttonGroup"
152
+ :key="index"
153
+ :style="{ background: item.backgroundColor, color: item.color }"
154
+ class="flex uni-tab__cart-button-right"
155
+ @click="buttonClick(index, item)"
156
+ >
157
+ <text :style="{ color: item.color }" class="uni-tab__cart-button-right-text">{{ item.text }}</text>
158
+ </view>
159
+ </view>
160
+ </view>
161
+ </view>
162
+ </template>
163
+ <script>
164
+ import { initVueI18n } from '@dcloudio/uni-i18n';
165
+ import messages from './i18n/index.js';
166
+ const { t } = initVueI18n(messages);
167
+ /**
168
+ * GoodsNav 商品导航
169
+ * @description 商品加入购物车、立即购买等
170
+ * @tutorial https://ext.dcloud.net.cn/plugin?id=865
171
+ * @property {Array} options 组件参数
172
+ * @property {Array} buttonGroup 组件按钮组参数
173
+ * @property {Boolean} fill = [true | false] 组件按钮组参数
174
+ * @property {Boolean} stat 是否开启统计功能
175
+ * @event {Function} click 左侧点击事件
176
+ * @event {Function} buttonClick 右侧按钮组点击事件
177
+ * @example <uni-goods-nav :fill="true" options="" buttonGroup="buttonGroup" @click="" @buttonClick="" />
178
+ */
179
+ export default {
180
+ name: 'UniGoodsNav',
181
+ emits: ['click', 'buttonClick'],
182
+ props: {
183
+ options: {
184
+ type: Array,
185
+ default() {
186
+ return [
187
+ {
188
+ icon: 'shop',
189
+ text: t('uni-goods-nav.options.shop')
190
+ },
191
+ {
192
+ icon: 'cart',
193
+ text: t('uni-goods-nav.options.cart')
194
+ }
195
+ ];
196
+ }
197
+ },
198
+ buttonGroup: {
199
+ type: Array,
200
+ default() {
201
+ return [
202
+ {
203
+ text: t('uni-goods-nav.buttonGroup.addToCart'),
204
+ backgroundColor: 'linear-gradient(90deg, #FFCD1E, #FF8A18)',
205
+ color: '#fff'
206
+ },
207
+ {
208
+ text: t('uni-goods-nav.buttonGroup.buyNow'),
209
+ backgroundColor: 'linear-gradient(90deg, #FE6035, #EF1224)',
210
+ color: '#fff'
211
+ }
212
+ ];
213
+ }
214
+ },
215
+ fill: {
216
+ type: Boolean,
217
+ default: false
218
+ },
219
+ stat: {
220
+ type: Boolean,
221
+ default: false
222
+ }
223
+ },
224
+ methods: {
225
+ onClick(index, item) {
226
+ this.$emit('click', {
227
+ index,
228
+ content: item
229
+ });
230
+ },
231
+ buttonClick(index, item) {
232
+ if (uni.report && this.stat) {
233
+ uni.report(item.text, item.text);
234
+ }
235
+ this.$emit('buttonClick', {
236
+ index,
237
+ content: item
238
+ });
239
+ }
240
+ }
241
+ };
242
+ </script>
243
+ <style>
244
+ @import 'style.css';
245
+ </style>
@@ -1 +1,115 @@
1
- <template>
2
1
  <view class="uni-grid-wrap">
3
2
  <view
4
3
  :id="elId"
5
4
  ref="uni-grid"
6
5
  class="uni-grid"
7
6
  :class="{ 'uni-grid--border': showBorder }"
8
7
  :style="{ 'border-left-color': borderColor }"
9
8
  >
10
9
  <slot />
11
10
  </view>
12
11
  </view>
13
12
  * Grid 宫格
14
13
  * @description 宫格组件
15
14
  * @tutorial https://ext.dcloud.net.cn/plugin?id=27
16
15
  * @property {Number} column 每列显示个数
17
16
  * @property {String} borderColor 边框颜色
18
17
  * @property {Boolean} showBorder 是否显示边框
19
18
  * @property {Boolean} square 是否方形显示
20
19
  * @property {Boolean} Boolean 点击背景是否高亮
21
20
  * @event {Function} change 点击 grid 触发,e={detail:{index:0}},index 为当前点击 gird 下标
22
21
  */
23
22
  name: 'UniGrid',
24
23
  emits: ['change'],
25
24
  props: {
26
25
  // 每列显示个数
27
26
  column: {
28
27
  type: Number,
29
28
  default: 3
30
29
  },
31
30
  // 是否显示边框
32
31
  showBorder: {
33
32
  type: Boolean,
34
33
  default: true
35
34
  },
36
35
  // 边框颜色
37
36
  borderColor: {
38
37
  type: String,
39
38
  default: '#D2D2D2'
40
39
  },
41
40
  // 是否正方形显示,默认为 true
42
41
  square: {
43
42
  type: Boolean,
44
43
  default: true
45
44
  },
46
45
  highlight: {
47
46
  type: Boolean,
48
47
  default: true
49
48
  }
50
49
  },
51
50
  provide() {
52
51
  return {
53
52
  grid: this
54
53
  };
55
54
  },
56
55
  data() {
57
56
  const elId = `Uni_${Math.ceil(Math.random() * 10e5).toString(36)}`;
58
57
  return {
59
58
  elId,
60
59
  width: 0
61
60
  };
62
61
  },
63
62
  created() {
64
63
  this.children = [];
65
64
  },
66
65
  mounted() {
67
66
  this.$nextTick(() => {
68
67
  this.init();
69
68
  });
70
69
  },
71
70
  methods: {
72
71
  init() {
73
72
  setTimeout(() => {
74
73
  this._getSize((width) => {
75
74
  this.children.forEach((item, index) => {
76
75
  item.width = width;
77
76
  });
78
77
  });
79
78
  }, 50);
80
79
  },
81
80
  change(e) {
82
81
  this.$emit('change', e);
83
82
  },
84
83
  _getSize(fn) {
85
84
  // #ifndef APP-NVUE
86
85
  uni
87
86
  .createSelectorQuery()
88
87
  .in(this)
89
88
  .select(`#${this.elId}`)
90
89
  .boundingClientRect()
91
90
  .exec((ret) => {
92
91
  this.width = parseInt((ret[0].width - 1) / this.column) + 'px';
93
92
  fn(this.width);
94
93
  });
95
94
  // #endif
96
95
  // #ifdef APP-NVUE
97
96
  dom.getComponentRect(this.$refs['uni-grid'], (ret) => {
98
97
  this.width = parseInt((ret.size.width - 1) / this.column) + 'px';
99
98
  fn(this.width);
100
99
  });
101
100
  // #endif
102
101
  }
103
102
  }
103
+ <template>
104
+ <view class="uni-grid-wrap">
105
+ <view
106
+ :id="elId"
107
+ ref="uni-grid"
108
+ class="uni-grid"
109
+ :class="{ 'uni-grid--border': showBorder }"
110
+ :style="{ 'border-left-color': borderColor }"
111
+ >
112
+ <slot />
113
+ </view>
114
+ </view>
115
+ </template>
116
+ <script>
117
+ // #ifdef APP-NVUE
118
+ const dom = uni.requireNativePlugin('dom');
119
+ // #endif
120
+ /**
121
+ * Grid 宫格
122
+ * @description 宫格组件
123
+ * @tutorial https://ext.dcloud.net.cn/plugin?id=27
124
+ * @property {Number} column 每列显示个数
125
+ * @property {String} borderColor 边框颜色
126
+ * @property {Boolean} showBorder 是否显示边框
127
+ * @property {Boolean} square 是否方形显示
128
+ * @property {Boolean} Boolean 点击背景是否高亮
129
+ * @event {Function} change 点击 grid 触发,e={detail:{index:0}},index 为当前点击 gird 下标
130
+ */
131
+ export default {
132
+ name: 'UniGrid',
133
+ emits: ['change'],
134
+ props: {
135
+ // 每列显示个数
136
+ column: {
137
+ type: Number,
138
+ default: 3
139
+ },
140
+ // 是否显示边框
141
+ showBorder: {
142
+ type: Boolean,
143
+ default: true
144
+ },
145
+ // 边框颜色
146
+ borderColor: {
147
+ type: String,
148
+ default: '#D2D2D2'
149
+ },
150
+ // 是否正方形显示,默认为 true
151
+ square: {
152
+ type: Boolean,
153
+ default: true
154
+ },
155
+ highlight: {
156
+ type: Boolean,
157
+ default: true
158
+ }
159
+ },
160
+ provide() {
161
+ return {
162
+ grid: this
163
+ };
164
+ },
165
+ data() {
166
+ const elId = `Uni_${Math.ceil(Math.random() * 10e5).toString(36)}`;
167
+ return {
168
+ elId,
169
+ width: 0
170
+ };
171
+ },
172
+ created() {
173
+ this.children = [];
174
+ },
175
+ mounted() {
176
+ this.$nextTick(() => {
177
+ this.init();
178
+ });
179
+ },
180
+ methods: {
181
+ init() {
182
+ setTimeout(() => {
183
+ this._getSize((width) => {
184
+ this.children.forEach((item, index) => {
185
+ item.width = width;
186
+ });
187
+ });
188
+ }, 50);
189
+ },
190
+ change(e) {
191
+ this.$emit('change', e);
192
+ },
193
+ _getSize(fn) {
194
+ // #ifndef APP-NVUE
195
+ uni
196
+ .createSelectorQuery()
197
+ .in(this)
198
+ .select(`#${this.elId}`)
199
+ .boundingClientRect()
200
+ .exec((ret) => {
201
+ this.width = parseInt((ret[0].width - 1) / this.column) + 'px';
202
+ fn(this.width);
203
+ });
204
+ // #endif
205
+ // #ifdef APP-NVUE
206
+ dom.getComponentRect(this.$refs['uni-grid'], (ret) => {
207
+ this.width = parseInt((ret.size.width - 1) / this.column) + 'px';
208
+ fn(this.width);
209
+ });
210
+ // #endif
211
+ }
212
+ }
213
+ };
214
+ </script>
215
+ <style>
216
+ @import 'style.css';
217
+ </style>
@@ -1 +1,78 @@
1
- <template>
2
1
  <view v-if="width" :style="'width:' + width + ';' + (square ? 'height:' + width : '')" class="uni-grid-item">
3
2
  <view
4
3
  :class="{
5
4
  'uni-grid-item--border': showBorder,
6
5
  'uni-grid-item--border-top': showBorder && index < column,
7
6
  'uni-highlight': highlight
8
7
  }"
9
8
  :style="{ 'border-right-color': borderColor, 'border-bottom-color': borderColor, 'border-top-color': borderColor }"
10
9
  class="uni-grid-item__box"
11
10
  @click="_onClick"
12
11
  >
13
12
  <slot />
14
13
  </view>
15
14
  </view>
16
15
  * GridItem 宫格
17
16
  * @description 宫格组件
18
17
  * @tutorial https://ext.dcloud.net.cn/plugin?id=27
19
18
  * @property {Number} index 子组件的唯一标识 ,点击gird会返回当前的标识
20
19
  */
21
20
  name: 'UniGridItem',
22
21
  inject: ['grid'],
23
22
  props: {
24
23
  index: {
25
24
  type: Number,
26
25
  default: 0
27
26
  }
28
27
  },
29
28
  data() {
30
29
  return {
31
30
  column: 0,
32
31
  showBorder: true,
33
32
  square: true,
34
33
  highlight: true,
35
34
  left: 0,
36
35
  top: 0,
37
36
  openNum: 2,
38
37
  width: 0,
39
38
  borderColor: '#e5e5e5'
40
39
  };
41
40
  },
42
41
  created() {
43
42
  this.column = this.grid.column;
44
43
  this.showBorder = this.grid.showBorder;
45
44
  this.square = this.grid.square;
46
45
  this.highlight = this.grid.highlight;
47
46
  this.top = this.hor === 0 ? this.grid.hor : this.hor;
48
47
  this.left = this.ver === 0 ? this.grid.ver : this.ver;
49
48
  this.borderColor = this.grid.borderColor;
50
49
  this.grid.children.push(this);
51
50
  // this.grid.init()
52
51
  this.width = this.grid.width;
53
52
  },
54
53
  beforeDestroy() {
55
54
  this.grid.children.forEach((item, index) => {
56
55
  if (item === this) {
57
56
  this.grid.children.splice(index, 1);
58
57
  }
59
58
  });
60
59
  },
61
60
  methods: {
62
61
  _onClick() {
63
62
  this.grid.change({
64
63
  detail: {
65
64
  index: this.index
66
65
  }
67
66
  });
68
67
  }
69
68
  }
69
+ <template>
70
+ <view v-if="width" :style="'width:' + width + ';' + (square ? 'height:' + width : '')" class="uni-grid-item">
71
+ <view
72
+ :class="{
73
+ 'uni-grid-item--border': showBorder,
74
+ 'uni-grid-item--border-top': showBorder && index < column,
75
+ 'uni-highlight': highlight
76
+ }"
77
+ :style="{ 'border-right-color': borderColor, 'border-bottom-color': borderColor, 'border-top-color': borderColor }"
78
+ class="uni-grid-item__box"
79
+ @click="_onClick"
80
+ >
81
+ <slot />
82
+ </view>
83
+ </view>
84
+ </template>
85
+ <script>
86
+ /**
87
+ * GridItem 宫格
88
+ * @description 宫格组件
89
+ * @tutorial https://ext.dcloud.net.cn/plugin?id=27
90
+ * @property {Number} index 子组件的唯一标识 ,点击gird会返回当前的标识
91
+ */
92
+ export default {
93
+ name: 'UniGridItem',
94
+ inject: ['grid'],
95
+ props: {
96
+ index: {
97
+ type: Number,
98
+ default: 0
99
+ }
100
+ },
101
+ data() {
102
+ return {
103
+ column: 0,
104
+ showBorder: true,
105
+ square: true,
106
+ highlight: true,
107
+ left: 0,
108
+ top: 0,
109
+ openNum: 2,
110
+ width: 0,
111
+ borderColor: '#e5e5e5'
112
+ };
113
+ },
114
+ created() {
115
+ this.column = this.grid.column;
116
+ this.showBorder = this.grid.showBorder;
117
+ this.square = this.grid.square;
118
+ this.highlight = this.grid.highlight;
119
+ this.top = this.hor === 0 ? this.grid.hor : this.hor;
120
+ this.left = this.ver === 0 ? this.grid.ver : this.ver;
121
+ this.borderColor = this.grid.borderColor;
122
+ this.grid.children.push(this);
123
+ // this.grid.init()
124
+ this.width = this.grid.width;
125
+ },
126
+ beforeDestroy() {
127
+ this.grid.children.forEach((item, index) => {
128
+ if (item === this) {
129
+ this.grid.children.splice(index, 1);
130
+ }
131
+ });
132
+ },
133
+ methods: {
134
+ _onClick() {
135
+ this.grid.change({
136
+ detail: {
137
+ index: this.index
138
+ }
139
+ });
140
+ }
141
+ }
142
+ };
143
+ </script>
144
+ <style>
145
+ @import 'style.css';
146
+ </style>