mali-applet-ui 0.0.32 → 0.0.35

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 (40) hide show
  1. package/README.md +32 -32
  2. package/components/ml-amount-input/ml-amount-input.vue +3 -2
  3. package/components/ml-amount-text/ml-amount-text.vue +2 -1
  4. package/components/ml-approval-type/ml-approval-type.vue +0 -0
  5. package/components/ml-button/ml-button.vue +3 -2
  6. package/components/ml-checkbox/ml-checkbox.vue +3 -2
  7. package/components/ml-checkbox-group/ml-checkbox-group.vue +3 -2
  8. package/components/ml-chunk-group/ml-chunk-group.vue +113 -0
  9. package/components/ml-chunk-item/ml-chunk-item.vue +73 -0
  10. package/components/ml-col/ml-col.vue +4 -3
  11. package/components/ml-date-picker/ml-date-picker.vue +2 -1
  12. package/components/ml-date-range-picker/ml-date-range-picker.vue +3 -2
  13. package/components/ml-datetime-picker/ml-datetime-picker.vue +2 -1
  14. package/components/ml-datetime-range-picker/ml-datetime-range-picker.vue +3 -2
  15. package/components/ml-echarts/ml-echarts.vue +3 -2
  16. package/components/ml-form/ml-form.vue +3 -2
  17. package/components/ml-form-item/ml-form-item.vue +3 -2
  18. package/components/ml-full-watermark/ml-full-watermark.vue +3 -5
  19. package/components/ml-icon/ml-icon.vue +1 -1
  20. package/components/ml-image-swiper/ml-image-swiper.vue +44 -11
  21. package/components/ml-input/ml-input.vue +5 -4
  22. package/components/ml-list-menu-group/ml-list-menu-group.vue +51 -0
  23. package/components/ml-list-menu-item/ml-list-menu-item.vue +107 -0
  24. package/components/ml-month-picker/ml-month-picker.vue +3 -2
  25. package/components/ml-number-input/ml-number-input.vue +3 -2
  26. package/components/ml-progress-bar/ml-progress-bar.vue +3 -2
  27. package/components/ml-province-city-picker/ml-province-city-picker.vue +2 -1
  28. package/components/ml-radio/ml-radio.vue +3 -2
  29. package/components/ml-radio-button/ml-radio-button.vue +3 -2
  30. package/components/ml-radio-group/ml-radio-group.vue +3 -2
  31. package/components/ml-row/ml-row.vue +3 -2
  32. package/components/ml-section/ml-section.vue +3 -2
  33. package/components/ml-select-picker/ml-select-picker.vue +3 -2
  34. package/components/ml-tabbar/ml-tabbar.vue +7 -3
  35. package/components/ml-table/ml-table.vue +2 -1
  36. package/components/ml-tabs/ml-tabs.vue +3 -2
  37. package/components/ml-textarea/ml-textarea.vue +3 -2
  38. package/components/ml-year-picker/ml-year-picker.vue +3 -2
  39. package/package.json +1 -1
  40. package/components/ml-list-menu/ml-list-menu.vue +0 -78
package/README.md CHANGED
@@ -1,32 +1,32 @@
1
- # mali-applet-ui
2
-
3
- Mali-Applet-UI 码里云小程序组件库
4
-
5
- ## 安装
6
-
7
- ```bash
8
- # npm方式安装
9
- npm install mali-applet-ui
10
- ```
11
-
12
- ## 按需引入
13
-
14
- 1. `pages.json`配置easycom规则(按需引入)
15
-
16
- ```js
17
- // pages.json
18
- {
19
- "easycom": {
20
- "autoscan": true,
21
- "custom": {
22
- "^ml-(.*)": "mali-applet-ui/components/ml-$1/ml-$1.vue"
23
- }
24
- },
25
- // 此为本身已有的内容
26
- "pages": [
27
- // ......
28
- ]
29
- }
30
- ```
31
-
32
- 深圳叮当科技技术有限公司
1
+ # mali-applet-ui
2
+
3
+ Mali-Applet-UI 码里云小程序组件库
4
+
5
+ ## 安装
6
+
7
+ ```bash
8
+ # npm方式安装
9
+ npm install mali-applet-ui
10
+ ```
11
+
12
+ ## 按需引入
13
+
14
+ 1. `pages.json`配置easycom规则(按需引入)
15
+
16
+ ```js
17
+ // pages.json
18
+ {
19
+ "easycom": {
20
+ "autoscan": true,
21
+ "custom": {
22
+ "^ml-(.*)": "mali-applet-ui/components/ml-$1/ml-$1.vue"
23
+ }
24
+ },
25
+ // 此为本身已有的内容
26
+ "pages": [
27
+ // ......
28
+ ]
29
+ }
30
+ ```
31
+
32
+ 深圳叮当科技技术有限公司
@@ -3,7 +3,7 @@
3
3
  class="ml-amount-input"
4
4
  v-model="inpVal"
5
5
  type="text"
6
- :class="{'is-right': align === 'right', 'is-border': border}"
6
+ :class="[{'is-right': align === 'right', 'is-border': border}, className]"
7
7
  autocomplete="off"
8
8
  :placeholder="placeholder"
9
9
  :maxlength="maxLength"
@@ -44,7 +44,8 @@ export default {
44
44
  disabled: {
45
45
  type: Boolean,
46
46
  default: false
47
- }
47
+ },
48
+ className: String
48
49
  },
49
50
  data () {
50
51
  return {
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <view class="ml-amount-text">
2
+ <view class="ml-amount-text" :class="className">
3
3
  <slot name="symbol">
4
4
  <view v-if="symbol" class="amount-flag">¥</view>
5
5
  </slot>
@@ -31,6 +31,7 @@ export default {
31
31
  type: Boolean,
32
32
  default: false
33
33
  },
34
+ className: String
34
35
  },
35
36
  computed: {
36
37
  amountUnit () {
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <button class="ml-button" :class="[`type-${type}`, status ? `status-${status}` : '', round ? 'is-round' : '']" @tap="tapEvent" @click="clickEvent">
2
+ <button class="ml-button" :class="[className, `type-${type}`, status ? `status-${status}` : '', round ? 'is-round' : '']" @tap="tapEvent" @click="clickEvent">
3
3
  <slot>{{ content }}</slot>
4
4
  </button>
5
5
  </template>
@@ -17,7 +17,8 @@ export default {
17
17
  type: {
18
18
  type: String,
19
19
  default: 'button'
20
- }
20
+ },
21
+ className: String
21
22
  },
22
23
  methods: {
23
24
  tapEvent () {
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <view class="ml-checkbox" :class="{'is-checked': checked, 'is-disabled': disabled}" @tap="tapEvent">
2
+ <view class="ml-checkbox" :class="[className, {'is-checked': checked, 'is-disabled': disabled}]" @tap="tapEvent">
3
3
  <ml-icon class="checkbox-icon" :name="checked ? 'checkbox-checked' : (indeterminate ? 'checkbox-indeterminate' : 'checkbox-unchecked')"></ml-icon>
4
4
  <text class="checkbox-content">
5
5
  <slot>
@@ -23,7 +23,8 @@ export default {
23
23
  },
24
24
  indeterminate: Boolean,
25
25
  disabled: Boolean,
26
- content: String
26
+ content: String,
27
+ className: String
27
28
  },
28
29
  computed: {
29
30
  checked () {
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <view class="ml-radio-group" :class="{'is-disabled': disabled, 'is-vertical': vertical}">
2
+ <view class="ml-radio-group" :class="[className, {'is-disabled': disabled, 'is-vertical': vertical}]">
3
3
  <view class="ml-radio-group-item" v-for="(item, index) in options" :key="index">
4
4
  <ml-checkbox :value="value.includes(item.value) ? item.value : null" :label="item.value" :content="item.label" :disabled="disabled || item.disabled" @change="changeEvent"></ml-checkbox>
5
5
  </view>
@@ -16,7 +16,8 @@ export default {
16
16
  value: Array,
17
17
  options: Array,
18
18
  disabled: Boolean,
19
- vertical: Boolean
19
+ vertical: Boolean,
20
+ className: String
20
21
  },
21
22
  methods: {
22
23
  changeEvent ({ label, checked }) {
@@ -0,0 +1,113 @@
1
+ <template>
2
+ <view class="ml-chunk-group" :class="[className, status ? `status-${status}` : '', align ? `align-${align}` : '', {'is-vertical': vertical, 'is-header': title || $slots.title}]">
3
+ <view v-if="title || $slots.title" class="ml-chunk-group-title">
4
+ <slot name="title">
5
+ <view v-if="prefixIcon" class="ml-chunk-group-left-icon">
6
+ <ml-icon :className="prefixIcon"></ml-icon>
7
+ </view>
8
+ <text class="ml-chunk-group-title-content">{{ title }}</text>
9
+ </slot>
10
+ </view>
11
+ <view class="ml-chunk-group-body">
12
+ <view class="ml-chunk-group-content">
13
+ <slot></slot>
14
+ </view>
15
+ </view>
16
+ </view>
17
+ </template>
18
+
19
+ <script>
20
+ export default {
21
+ name: 'MlChunkGroup',
22
+ options: {
23
+ virtualHost: true
24
+ },
25
+ props: {
26
+ title: String,
27
+ prefixIcon: String,
28
+ vertical: Boolean,
29
+ status: String,
30
+ align: String,
31
+ className: String
32
+ },
33
+ provide() {
34
+ return {
35
+ mlChunk: this
36
+ }
37
+ }
38
+ }
39
+ </script>
40
+
41
+ <style lang="scss">
42
+ .ml-chunk-group {
43
+ display: block;
44
+ border-radius: 10rpx;
45
+ background: #ffffff;
46
+ .ml-chunk-group-title {
47
+ display: flex;
48
+ flex-direction: row;
49
+ align-items: center;
50
+ height: 70rpx;
51
+ padding: 0 20rpx ;
52
+ }
53
+ .ml-chunk-group-left-icon {
54
+ font-size: 38rpx;
55
+ flex-shrink: 0;
56
+ padding-right: 10rpx;
57
+ }
58
+ .ml-chunk-group-content {
59
+ display: flex;
60
+ flex-direction: row;
61
+ border-radius: 10rpx;
62
+ }
63
+ &.is-header {
64
+ .ml-chunk-group-body {
65
+ padding: 0 20rpx;
66
+ }
67
+ }
68
+ &.is-vertical {
69
+ .ml-chunk-group-content {
70
+ flex-direction: column;
71
+ }
72
+ }
73
+ &.align-left {
74
+ text-align: left;
75
+ }
76
+ &.align-center {
77
+ text-align: center;
78
+ }
79
+ &.align-right {
80
+ text-align: right;
81
+ }
82
+ &.status-primary {
83
+ .ml-chunk-group-content {
84
+ color: #ffffff;
85
+ background: $uni-color-primary;
86
+ }
87
+ }
88
+ &.status-success {
89
+ .ml-chunk-group-content {
90
+ color: #ffffff;
91
+ background: $uni-color-success;
92
+ }
93
+ }
94
+ &.status-info {
95
+ .ml-chunk-group-content {
96
+ color: #ffffff;
97
+ background: #909399;
98
+ }
99
+ }
100
+ &.status-warning {
101
+ .ml-chunk-group-content {
102
+ color: #ffffff;
103
+ background: $uni-color-warning;
104
+ }
105
+ }
106
+ &.status-danger {
107
+ .ml-chunk-group-content {
108
+ color: #ffffff;
109
+ background: $uni-color-error;
110
+ }
111
+ }
112
+ }
113
+ </style>
@@ -0,0 +1,73 @@
1
+ <template>
2
+ <view class="ml-chunk-item" :class="[className, span && !width ? `span-${span}` : '', align ? `align-${align}` : '', {'is-fixed': width, 'is-vertical': isVertical}]" :style="styles">
3
+ <slot></slot>
4
+ </view>
5
+ </template>
6
+
7
+ <script>
8
+ export default {
9
+ name: 'MlChunkItem',
10
+ options: {
11
+ virtualHost: true
12
+ },
13
+ props: {
14
+ span: [String, Number],
15
+ align: String,
16
+ width: String,
17
+ className: String
18
+ },
19
+ inject: {
20
+ chunk: {
21
+ from: 'mlChunk',
22
+ default: null
23
+ }
24
+ },
25
+ computed: {
26
+ isVertical () {
27
+ return this.chunk ? this.chunk.vertical : ''
28
+ },
29
+ styles () {
30
+ return this.width ? `width: ${this.width};` : ''
31
+ }
32
+ }
33
+ }
34
+ </script>
35
+
36
+ <style lang="scss">
37
+ .ml-chunk-item {
38
+ display: flex;
39
+ flex-direction: column;
40
+ padding: 10rpx;
41
+ line-height: 50rpx;
42
+ $spans: 4.16667%, 8.33333%, 12.5%, 16.66667%, 20.83333%, 25%, 29.16667%, 33.33333%,
43
+ 37.5%, 41.66667%, 45.83333%, 50%, 54.16667%, 58.33333%, 62.5%, 66.66667%,
44
+ 70.83333%, 75%, 79.16667%, 83.33333%, 87.5%, 91.66667%, 95.83333%, 100%;
45
+ &.align-left {
46
+ text-align: left;
47
+ }
48
+ &.align-center {
49
+ text-align: center;
50
+ }
51
+ &.align-right {
52
+ text-align: right;
53
+ }
54
+ &:not(.is-fixed) {
55
+ flex-grow: 1;
56
+ }
57
+ @for $index from 0 to length($spans) {
58
+ &.span-#{$index + 1} {
59
+ width: nth($spans, $index + 1);
60
+ }
61
+ }
62
+ &:not(.is-vertical) {
63
+ border-right: 1px solid rgba(255, 255, 255, 0.2);
64
+ }
65
+ &.is-vertical {
66
+ flex-direction: row;
67
+ border-bottom: 1px solid rgba(255, 255, 255, 0.2);
68
+ }
69
+ &:last-child {
70
+ border: 0;
71
+ }
72
+ }
73
+ </style>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <view class="ml-col" :class="[span && !width ? `span-${span}` : '', align ? `align-${align}` : '', width ? 'is-fixed' : '']" :style="styles">
2
+ <view class="ml-col" :class="[className, span && !width ? `span-${span}` : '', align ? `align-${align}` : '', width ? 'is-fixed' : '']" :style="styles">
3
3
  <slot></slot>
4
4
  </view>
5
5
  </template>
@@ -13,11 +13,12 @@ export default {
13
13
  props: {
14
14
  span: [String, Number],
15
15
  align: String,
16
- width: String
16
+ width: String,
17
+ className: String
17
18
  },
18
19
  computed: {
19
20
  styles () {
20
- return this.width ? `${this.width}` : ''
21
+ return this.width ? `width: ${this.width};` : ''
21
22
  }
22
23
  }
23
24
  }
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <uni-datetime-picker v-model="selectVal" type="date" :start="start" :end="end" @change="changeEvent" :border="border"/>
2
+ <uni-datetime-picker :class="className" v-model="selectVal" type="date" :start="start" :end="end" @change="changeEvent" :border="border"/>
3
3
  </template>
4
4
 
5
5
  <script>
@@ -13,6 +13,7 @@ export default {
13
13
  border: Boolean,
14
14
  start: [String, Number],
15
15
  end: [String, Number],
16
+ className: String
16
17
  },
17
18
  data () {
18
19
  return {
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <uni-datetime-picker v-model="selectDates" type="daterange" :start="start" :end="end" @change="changeEvent" :border="border" :clear-icon="clear"/>
2
+ <uni-datetime-picker :class="className" v-model="selectDates" type="daterange" :start="start" :end="end" @change="changeEvent" :border="border" :clear-icon="clear"/>
3
3
  </template>
4
4
 
5
5
  <script>
@@ -17,7 +17,8 @@ export default {
17
17
  clear: {
18
18
  type: Boolean,
19
19
  default: true
20
- }
20
+ },
21
+ className: String
21
22
  },
22
23
  data () {
23
24
  return {
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <uni-datetime-picker v-model="selectVal" type="datetime" :start="start" :end="end" @change="changeEvent" :border="border"/>
2
+ <uni-datetime-picker :class="className" v-model="selectVal" type="datetime" :start="start" :end="end" @change="changeEvent" :border="border"/>
3
3
  </template>
4
4
 
5
5
  <script>
@@ -13,6 +13,7 @@ export default {
13
13
  border: Boolean,
14
14
  start: [String, Number],
15
15
  end: [String, Number],
16
+ className: String
16
17
  },
17
18
  data () {
18
19
  return {
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <uni-datetime-picker v-model="selectDates" type="datetimerange" :start="start" :end="end" @change="changeEvent" :border="border"/>
2
+ <uni-datetime-picker :class="className" v-model="selectDates" type="datetimerange" :start="start" :end="end" @change="changeEvent" :border="border"/>
3
3
  </template>
4
4
 
5
5
  <script>
@@ -13,7 +13,8 @@ export default {
13
13
  startDate: String,
14
14
  endDate: String,
15
15
  start: [String, Number],
16
- end: [String, Number]
16
+ end: [String, Number],
17
+ className: String
17
18
  },
18
19
  data () {
19
20
  return {
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <view class="ml-echarts" :style="{height: height || '400rpx', width: width || '100%'}">
2
+ <view class="ml-echarts" :class="className" :style="{height: height || '400rpx', width: width || '100%'}">
3
3
  <canvas type="2d" class="ml-canvas" :canvas-id="canvasId" @touchstart="touchStart" @touchmove="touchMove" @touchend="touchEnd"></canvas>
4
4
  </view>
5
5
  </template>
@@ -44,7 +44,8 @@ export default {
44
44
  height:String,
45
45
  width: String,
46
46
  lazyLoad:Boolean,
47
- forceUseOldCanvas: Boolean
47
+ forceUseOldCanvas: Boolean,
48
+ className: String
48
49
  },
49
50
  data() {
50
51
  return {
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <view class="ml-form" :class="{'is-vertical': vertical}">
2
+ <view class="ml-form" :class="[className, {'is-vertical': vertical}]">
3
3
  <uni-forms ref="uniForm" :modelValue="data" :rules="formRules" :label-position="vertical ? 'top' : 'left'">
4
4
  <slot></slot>
5
5
  </uni-forms>
@@ -18,7 +18,8 @@ export default {
18
18
  data: Object,
19
19
  items: Array,
20
20
  rules: Object,
21
- vertical: Boolean
21
+ vertical: Boolean,
22
+ className: String
22
23
  },
23
24
  data () {
24
25
  return {
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <uni-forms-item :label="title" :name="field">
2
+ <uni-forms-item :class="className" :label="title" :name="field">
3
3
  <slot></slot>
4
4
  </uni-forms-item>
5
5
  </template>
@@ -12,7 +12,8 @@ export default {
12
12
  },
13
13
  props: {
14
14
  title: String,
15
- field: String
15
+ field: String,
16
+ className: String
16
17
  }
17
18
  }
18
19
  </script>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <view class="ml-full-watermark">
2
+ <view class="ml-full-watermark" :class="className">
3
3
  <view class="ml-full-watermark-text" v-for="index in 40" :key="index">{{ content }}</view>
4
4
  </view>
5
5
  </template>
@@ -7,11 +7,9 @@
7
7
  <script>
8
8
  export default {
9
9
  name: 'MlFullWatermark',
10
- options: {
11
- virtualHost: true
12
- },
13
10
  props: {
14
- content: String
11
+ content: String,
12
+ className: String
15
13
  }
16
14
  }
17
15
  </script>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <text class="ml-icon" :class="[name ? `${prefix}${name}` : '', className]" @click="clickEvent"></text>
2
+ <text class="ml-icon" :class="[className, name ? `${prefix}${name}` : '']" @click="clickEvent"></text>
3
3
  </template>
4
4
 
5
5
  <script>
@@ -1,33 +1,66 @@
1
1
  <template>
2
- <view class="ml-image-swiper">
3
- <swiper :autoplay="autoplay" :interval="interval" :style="{height: height || '400rpx'}" circular indicator-dots>
4
- <swiper-item v-for="(item, index) in options" :key="index">
5
- <image class="ml-image-swiper-img" mode="widthFix" :src="item.url"></image>
6
- </swiper-item>
7
- </swiper>
8
- </view>
2
+ <swiper class="ml-image-swiper" :current="current" :class="className" :style="styles" :autoplay="autoplay" :interval="interval" circular indicator-dots @change="changeEvent">
3
+ <swiper-item v-for="(item, index) in options" :key="index">
4
+ <image class="ml-image-swiper-img" mode="aspectFill" :src="item.url"></image>
5
+ </swiper-item>
6
+ </swiper>
9
7
  </template>
10
8
 
11
9
  <script>
10
+ import XEUtils from 'xe-utils'
12
11
  export default {
13
12
  name: 'MlImageSwiper',
14
13
  options: {
15
14
  virtualHost: true
16
15
  },
17
16
  props: {
18
- value: Number,
17
+ value: [Number, String],
19
18
  options: Array,
20
19
  autoplay: Boolean,
21
20
  interval: Number,
22
- width: String,
23
- height: String
24
- }
21
+ height: String,
22
+ className: String
23
+ },
24
+ data () {
25
+ return {
26
+ current: 0
27
+ }
28
+ },
29
+ computed: {
30
+ styles () {
31
+ return this.height ? `height: ${this.height};` : ''
32
+ }
33
+ },
34
+ watch: {
35
+ value () {
36
+ this.updateActive()
37
+ }
38
+ },
39
+ created () {
40
+ this.updateActive()
41
+ },
42
+ methods: {
43
+ updateActive () {
44
+ const index = XEUtils.findIndexOf(this.options, item => item.value === this.value)
45
+ this.current = index > -1 ? index : 0
46
+ },
47
+ changeEvent (e) {
48
+ const index = e.detail.current
49
+ const option = this.options[index]
50
+ this.current = index
51
+ const value = option ? option.value : 0
52
+ this.$emit('input', value)
53
+ this.$emit('change', { value, option })
54
+ }
55
+ }
25
56
  }
26
57
  </script>
27
58
 
28
59
  <style lang="scss">
29
60
  .ml-image-swiper {
61
+ height: 100%;
30
62
  .ml-image-swiper-img {
63
+ height: 100%;
31
64
  width: 100%;
32
65
  }
33
66
  }
@@ -1,7 +1,7 @@
1
1
  <template>
2
- <view class="ml-input" :class="{'is-right': align === 'right', 'is-border': border, 'is-prefix': prefixIcon || type === 'search', 'is-suffix': suffixIcon, 'is-disabled': disabled}">
2
+ <view class="ml-input" :class="[className, {'is-right': align === 'right', 'is-border': border, 'is-prefix': prefixIcon || type === 'search', 'is-suffix': suffixIcon, 'is-disabled': disabled}]">
3
3
  <view v-if="prefixIcon || type === 'search'" class="ml-input-prefix-icon">
4
- <ml-icon v-if="prefixIcon" :className="prefixIcon"></ml-icon>
4
+ <ml-icon v-if="prefixIcon" :class="prefixIcon"></ml-icon>
5
5
  <ml-icon v-else name="search"></ml-icon>
6
6
  </view>
7
7
  <input
@@ -12,7 +12,7 @@
12
12
  :placeholder="placeholder"
13
13
  @input="inputEvent" />
14
14
  <view v-if="suffixIcon" class="ml-input-suffix-icon">
15
- <ml-icon :className="suffixIcon"></ml-icon>
15
+ <ml-icon :class="suffixIcon"></ml-icon>
16
16
  </view>
17
17
  </view>
18
18
  </template>
@@ -34,7 +34,8 @@ export default {
34
34
  placeholder: {
35
35
  type: String,
36
36
  default: '请输入'
37
- }
37
+ },
38
+ className: String
38
39
  },
39
40
  data () {
40
41
  return {
@@ -0,0 +1,51 @@
1
+ <template>
2
+ <view class="ml-list-menu-group" :class="className">
3
+ <view v-if="title || $slots.title" class="ml-list-menu-group-title">
4
+ <slot name="title">
5
+ <view v-if="prefixIcon" class="ml-list-menu-group-left-icon">
6
+ <ml-icon :className="prefixIcon"></ml-icon>
7
+ </view>
8
+ <text class="ml-list-menu-group-title-content">{{ title }}</text>
9
+ </slot>
10
+ </view>
11
+ <view class="ml-list-menu-group-content">
12
+ <slot></slot>
13
+ </view>
14
+ </view>
15
+ </template>
16
+
17
+ <script>
18
+ export default {
19
+ name: 'MlListMenuGroup',
20
+ options: {
21
+ virtualHost: true
22
+ },
23
+ props: {
24
+ title: String,
25
+ prefixIcon: String,
26
+ className: String
27
+ }
28
+ }
29
+ </script>
30
+
31
+ <style lang="scss">
32
+ .ml-list-menu-group {
33
+ margin: 20rpx 0;
34
+ background: #ffffff;
35
+ .ml-list-menu-group-title {
36
+ display: flex;
37
+ flex-direction: row;
38
+ align-items: center;
39
+ height: 70rpx;
40
+ }
41
+ .ml-list-menu-group-left-icon {
42
+ font-size: 38rpx;
43
+ flex-shrink: 0;
44
+ padding: 0 10rpx;
45
+ }
46
+ .ml-list-menu-group-content {
47
+ display: flex;
48
+ flex-direction: column;
49
+ }
50
+ }
51
+ </style>
@@ -0,0 +1,107 @@
1
+ <template>
2
+ <view class="ml-list-menu-item" :class="className" @click="clickEvent" @tap="tapEvent">
3
+ <view v-if="prefixIcon" class="ml-list-menu-item-left-icon">
4
+ <ml-icon :className="prefixIcon"></ml-icon>
5
+ </view>
6
+ <view class="ml-list-menu-item-content">
7
+ <slot>
8
+ <text>{{ name }}</text>
9
+ </slot>
10
+ </view>
11
+ <view v-if="showDot" class="ml-list-menu-item-dot">
12
+ <text class="ml-list-menu-item-dot-num">{{ getDotNum(dotNum) }}</text>
13
+ </view>
14
+ <view class="ml-list-menu-item-right-icon">
15
+ <ml-icon class="right-icon" name="arrow-right"></ml-icon>
16
+ </view>
17
+ </view>
18
+ </template>
19
+
20
+ <script>
21
+ export default {
22
+ name: 'MlListMenuItem',
23
+ options: {
24
+ virtualHost: true
25
+ },
26
+ props: {
27
+ name: String,
28
+ prefixIcon: String,
29
+ suffixIcon: String,
30
+ url: String,
31
+ redirect: Boolean,
32
+ className: String,
33
+ showDot: Boolean,
34
+ dotNum: [String, Number]
35
+ },
36
+ methods: {
37
+ getDotNum (num) {
38
+ return num > 99 ? '99+' : num
39
+ },
40
+ clickEvent () {
41
+ this.$emit('click', {})
42
+ },
43
+ tapEvent () {
44
+ if (this.url) {
45
+ if (this.redirect) {
46
+ uni.redirectTo({
47
+ url: this.url
48
+ })
49
+ } else {
50
+ uni.navigateTo({
51
+ url: this.url
52
+ })
53
+ }
54
+ }
55
+ this.$emit('tap', {})
56
+ }
57
+ }
58
+ }
59
+ </script>
60
+
61
+ <style lang="scss">
62
+ .ml-list-menu-item {
63
+ display: flex;
64
+ flex-direction: row;
65
+ border-bottom: 1px solid #e5e5e5;
66
+ line-height: 90rpx;
67
+ font-size: 30rpx;
68
+ padding: 0 20rpx;
69
+ background: #ffffff;
70
+ &:first-child {
71
+ border-top: 1px solid #e5e5e5;
72
+ }
73
+ .ml-list-menu-item-content {
74
+ flex-grow: 1;
75
+ overflow: hidden;
76
+ text-overflow: ellipsis;
77
+ white-space: nowrap;
78
+ }
79
+ .ml-list-menu-item-dot {
80
+ position: relative;
81
+ flex-shrink: 0;
82
+ .ml-list-menu-item-dot-num {
83
+ background-color: #f56c6c;
84
+ color: #fff;
85
+ border-radius: 40rpx;
86
+ padding: 0 10rpx;
87
+ vertical-align: middle;
88
+ display: inline-block;
89
+ min-width: 40rpx;
90
+ text-align: center;
91
+ font-size: 22rpx;
92
+ line-height: 40rpx;
93
+ }
94
+ }
95
+ .ml-list-menu-item-left-icon,
96
+ .ml-list-menu-item-right-icon {
97
+ flex-shrink: 0;
98
+ padding: 0 10rpx;
99
+ }
100
+ .ml-list-menu-item-left-icon {
101
+ font-size: 38rpx;
102
+ }
103
+ .ml-list-menu-item-right-icon {
104
+ font-size: 30rpx;
105
+ }
106
+ }
107
+ </style>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <picker :value="value" class="ml-month-picker" :class="{'is-border': border}" mode="date" fields="month" @change="changeEvent">
2
+ <picker :value="value" class="ml-month-picker" :class="[className, {'is-border': border}]" mode="date" fields="month" @change="changeEvent">
3
3
  <view class="picker-warpper">
4
4
  <view class="picker-text">{{ value || '请选择' }}</view>
5
5
  <ml-icon class="picker-icon" name="arrow-down"></ml-icon>
@@ -15,7 +15,8 @@ export default {
15
15
  },
16
16
  props: {
17
17
  value: String,
18
- border: Boolean
18
+ border: Boolean,
19
+ className: String
19
20
  },
20
21
  methods: {
21
22
  changeEvent (e) {
@@ -3,7 +3,7 @@
3
3
  class="ml-number-input"
4
4
  v-model="inpVal"
5
5
  type="text"
6
- :class="{'is-right': align === 'right', 'is-border': border}"
6
+ :class="[className, {'is-right': align === 'right', 'is-border': border}]"
7
7
  autocomplete="off"
8
8
  :placeholder="placeholder"
9
9
  :maxlength="maxLength"
@@ -32,7 +32,8 @@ export default {
32
32
  disabled: {
33
33
  type: Boolean,
34
34
  default: false
35
- }
35
+ },
36
+ className: String
36
37
  },
37
38
  data () {
38
39
  return {
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <view class="ml-progress-bar">
2
+ <view class="ml-progress-bar" :class="className">
3
3
  <view class="progress-bar-header">
4
4
  <slot name="header">
5
5
  <view v-if="title !== null" class="progress-bar-title" :class="{underline: titleUnderline}">{{ title }}</view>
@@ -52,7 +52,8 @@ export default {
52
52
  },
53
53
  backgroundColor: String,
54
54
  showNum: Boolean,
55
- unit: String
55
+ unit: String,
56
+ className: String
56
57
  },
57
58
  computed: {
58
59
  percNum () {
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <view class="ml-region-picker" :style="{width: width || '160rpx'}">
2
+ <view class="ml-region-picker" :class="className" :style="{width: width || '160rpx'}">
3
3
  <uni-data-picker
4
4
  v-model="selectVals"
5
5
  popup-title="请选择城市"
@@ -26,6 +26,7 @@ export default {
26
26
  city: String,
27
27
  width: String,
28
28
  optionProps: Object,
29
+ className: String
29
30
  },
30
31
  data () {
31
32
  return {
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <view class="ml-radio" :class="{'is-checked': checked, 'is-disabled': disabled}" @tap="tapEvent">
2
+ <view class="ml-radio" :class="[className, {'is-checked': checked, 'is-disabled': disabled}]" @tap="tapEvent">
3
3
  <ml-icon class="radio-icon" :name="checked ? 'radio-checked' : 'radio-unchecked'"></ml-icon>
4
4
  <text class="radio-content">
5
5
  <slot>
@@ -22,7 +22,8 @@ export default {
22
22
  default: false
23
23
  },
24
24
  disabled: Boolean,
25
- content: String
25
+ content: String,
26
+ className: String
26
27
  },
27
28
  computed: {
28
29
  checked () {
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <view class="ml-radio-button" :class="{'is-disabled': disabled}">
2
+ <view class="ml-radio-button" :class="[className, {'is-disabled': disabled}]">
3
3
  <view class="ml-radio-button-item" v-for="(item, index) in options" :class="{'is-active': value === item.value}" :key="index" @tap="changeEvent(item)">{{ item.label }}</view>
4
4
  </view>
5
5
  </template>
@@ -13,7 +13,8 @@ export default {
13
13
  props: {
14
14
  value: [Boolean, Number, String],
15
15
  options: Array,
16
- disabled: Boolean
16
+ disabled: Boolean,
17
+ className: String
17
18
  },
18
19
  methods: {
19
20
  changeEvent (option) {
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <view class="ml-radio-group" :class="{'is-disabled': disabled, 'is-vertical': vertical}">
2
+ <view class="ml-radio-group" :class="[className, {'is-disabled': disabled, 'is-vertical': vertical}]">
3
3
  <view class="ml-radio-group-item" v-for="(item, index) in options" :key="index">
4
4
  <ml-radio :value="value" :label="item.value" :content="item.label" :disabled="disabled || item.disabled" @change="changeEvent"></ml-radio>
5
5
  </view>
@@ -16,7 +16,8 @@ export default {
16
16
  value: [Boolean, Number, String],
17
17
  options: Array,
18
18
  disabled: Boolean,
19
- vertical: Boolean
19
+ vertical: Boolean,
20
+ className: String
20
21
  },
21
22
  methods: {
22
23
  changeEvent ({ value }) {
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <view class="ml-row" :class="{'is-vertical': vertical}">
2
+ <view class="ml-row" :class="[className, {'is-vertical': vertical}]">
3
3
  <slot></slot>
4
4
  </view>
5
5
  </template>
@@ -11,7 +11,8 @@ export default {
11
11
  virtualHost: true
12
12
  },
13
13
  props: {
14
- vertical: Boolean
14
+ vertical: Boolean,
15
+ className: String
15
16
  }
16
17
  }
17
18
  </script>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <view class="ml-section" :class="[type ? `type-${type}` : '']">
2
+ <view class="ml-section" :class="[className, type ? `type-${type}` : '']">
3
3
  <view v-if="title || $slots.header" class="ml-section-header">
4
4
  <slot name="header">
5
5
  <text class="ml-section-header-title">{{ title }}</text>
@@ -19,7 +19,8 @@ export default {
19
19
  },
20
20
  props: {
21
21
  title: String,
22
- type: String
22
+ type: String,
23
+ className: String
23
24
  }
24
25
  }
25
26
  </script>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <picker class="ml-select-picker" :class="{'is-border': border}" :range="optionList" :range-key="optLabelField" @change="changeEvent">
2
+ <picker class="ml-select-picker" :class="[className, {'is-border': border}]" :range="optionList" :range-key="optLabelField" @change="changeEvent">
3
3
  <view class="picker-warpper" :style="{width: width || '160rpx'}">
4
4
  <view class="picker-text">
5
5
  <text v-if="value !== null">{{ selectName }}</text>
@@ -26,7 +26,8 @@ export default {
26
26
  options: Array,
27
27
  optionProps: Object,
28
28
  width: String,
29
- isAll: Boolean
29
+ isAll: Boolean,
30
+ className: String
30
31
  },
31
32
  data () {
32
33
  return {
@@ -1,9 +1,9 @@
1
1
  <template>
2
- <view class="ml-tabbar">
2
+ <view class="ml-tabbar" :class="className">
3
3
  <view class="ml-tabbar-item" v-for="(item) in options" :key="item.value" :class="{'is-active': value == item.value}" @tap="tapEvent(item)">
4
4
  <view class="ml-tabbar-icon">
5
5
  <ml-icon class="icon" :name="value == item.value ? item.activeIcon : item.icon"></ml-icon>
6
- <view v-if="item.showNum && item.num > 0" class="ml-tabbar-num">{{ item.num }}</view>
6
+ <view v-if="item.showDot && item.dotNum > 0" class="ml-tabbar-num">{{ getDotNum(item.dotNum) }}</view>
7
7
  </view>
8
8
  <view class="ml-tabbar-name">{{ item.name }}</view>
9
9
  </view>
@@ -15,7 +15,8 @@ export default {
15
15
  name: 'MlTabbar',
16
16
  props: {
17
17
  value: [String, Number],
18
- options: Array
18
+ options: Array,
19
+ className: String
19
20
  },
20
21
  data() {
21
22
  return {
@@ -45,6 +46,9 @@ export default {
45
46
  })
46
47
  }
47
48
  },
49
+ getDotNum (num) {
50
+ return num > 99 ? '99+' : num
51
+ },
48
52
  tapEvent (option) {
49
53
  const value = option.value
50
54
  this.updateTitle(option)
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <view class="ml-table" :style="{height: height ? (isNaN(height) ? height : `${height}rpx`) : ''}">
2
+ <view class="ml-table" :class="className" :style="{height: height ? (isNaN(height) ? height : `${height}rpx`) : ''}">
3
3
  <view class="table-header">
4
4
  <view class="table-column-header">
5
5
  <view class="table-tr">
@@ -75,6 +75,7 @@ export default {
75
75
  },
76
76
  props: {
77
77
  loading: Boolean,
78
+ className: String,
78
79
  height: [Number, String],
79
80
  headerData: Array,
80
81
  data: Array,
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <view class="ml-tabs">
2
+ <view class="ml-tabs" :class="className">
3
3
  <scroll-view scroll-x>
4
4
  <view class="ml-tabs-navs">
5
5
  <view class="ml-tabs-nav-item" v-for="(item, index) in options" :key="index" :class="{'is-active': value === item.value}" @tap="changeEvent(item)">{{ item.label }}</view>
@@ -16,7 +16,8 @@ export default {
16
16
  },
17
17
  props: {
18
18
  value: [String, Number],
19
- options: Array
19
+ options: Array,
20
+ className: String
20
21
  },
21
22
  data () {
22
23
  return {}
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <view class="ml-textarea" :class="{'is-border': border}">
2
+ <view class="ml-textarea" :class="[className, {'is-border': border}]">
3
3
  <view v-if="readonly" class="content">{{ inpVal }}</view>
4
4
  <view v-else>
5
5
  <textarea class="textarea" v-model="inpVal" :rows="rows" :maxlength="maxLength" :placeholder="placeholder" @input="inputEvent" :style="{color: fontColor, height: `${rows * 30}rpx`}"></textarea>
@@ -49,7 +49,8 @@ export default {
49
49
  default: false
50
50
  },
51
51
  showVoice: Boolean,
52
- fontColor: String
52
+ fontColor: String,
53
+ className: String
53
54
  },
54
55
  data () {
55
56
  return {
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <picker :value="value" class="ml-year-picker" :class="{'is-border': border}" mode="date" fields="year" @change="changeEvent">
2
+ <picker :value="value" class="ml-year-picker" :class="[className, {'is-border': border}]" mode="date" fields="year" @change="changeEvent">
3
3
  <view class="picker-warpper">
4
4
  <view class="picker-text">{{ value || '请选择' }}</view>
5
5
  <ml-icon class="picker-icon" name="arrow-down"></ml-icon>
@@ -15,7 +15,8 @@ export default {
15
15
  },
16
16
  props: {
17
17
  value: String,
18
- border: Boolean
18
+ border: Boolean,
19
+ className: String
19
20
  },
20
21
  methods: {
21
22
  changeEvent (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mali-applet-ui",
3
- "version": "0.0.32",
3
+ "version": "0.0.35",
4
4
  "description": "码里云小程序组件库",
5
5
  "files": [
6
6
  "components",
@@ -1,78 +0,0 @@
1
- <template>
2
- <view class="ml-list-menu" @click="clickEvent" @tap="tapEvent">
3
- <view v-if="prefixIcon" class="ml-list-menu-left-icon">
4
- <ml-icon :className="prefixIcon"></ml-icon>
5
- </view>
6
- <view class="ml-list-menu-content">
7
- <slot>
8
- <text>{{ name }}</text>
9
- </slot>
10
- </view>
11
- <view class="ml-list-menu-right-icon">
12
- <ml-icon class="right-icon" name="arrow-right"></ml-icon>
13
- </view>
14
- </view>
15
- </template>
16
-
17
- <script>
18
- export default {
19
- name: 'MlListMenu',
20
- options: {
21
- virtualHost: true
22
- },
23
- props: {
24
- name: String,
25
- prefixIcon: String,
26
- suffixIcon: String,
27
- url: String,
28
- redirect: Boolean
29
- },
30
- methods: {
31
- clickEvent () {
32
- this.$emit('click', {})
33
- },
34
- tapEvent () {
35
- if (this.url) {
36
- if (this.redirect) {
37
- uni.redirectTo({
38
- url: this.url
39
- })
40
- } else {
41
- uni.navigateTo({
42
- url: this.url
43
- })
44
- }
45
- }
46
- this.$emit('tap', {})
47
- }
48
- }
49
- }
50
- </script>
51
-
52
- <style lang="scss">
53
- .ml-list-menu {
54
- display: flex;
55
- flex-direction: row;
56
- border-bottom: 1px solid #e5e5e5;
57
- line-height: 90rpx;
58
- font-size: 30rpx;
59
- padding: 0 20rpx;
60
- .ml-list-menu-content {
61
- flex-grow: 1;
62
- overflow: hidden;
63
- text-overflow: ellipsis;
64
- white-space: nowrap;
65
- }
66
- .ml-list-menu-left-icon,
67
- .ml-list-menu-right-icon {
68
- flex-shrink: 0;
69
- padding: 0 10rpx;
70
- }
71
- .ml-list-menu-left-icon {
72
- font-size: 38rpx;
73
- }
74
- .ml-list-menu-right-icon {
75
- font-size: 30rpx;
76
- }
77
- }
78
- </style>