mali-applet-ui 0.0.36 → 0.0.39

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.
@@ -0,0 +1,50 @@
1
+ <template>
2
+ <view class="ml-approval-type" :class="className" :style="styles">{{ currLabel }}</view>
3
+ </template>
4
+
5
+ <script>
6
+ export default {
7
+ name: 'MlApprovalType',
8
+ options: {
9
+ virtualHost: true
10
+ },
11
+ props: {
12
+ value: [String, Number],
13
+ className: String
14
+ },
15
+ data () {
16
+ return {
17
+ statusList: [
18
+ { value: 0, label: '起草中', color: '' },
19
+ { value: 1, label: '审批中', color: '#09B2FE' },
20
+ { value: 2, label: '已通过', color: '#42E38D' },
21
+ { value: 3, label: '已驳回', color: '#FF4A4A' },
22
+ { value: 4, label: '会签中', color: '#F4788E' },
23
+ { value: 5, label: '处理中', color: '#FFA500' },
24
+ { value: 6, label: '已完成', color: '#2497FF' }
25
+ ]
26
+ }
27
+ },
28
+ computed: {
29
+ selectItem () {
30
+ return this.statusList.find(item => String(item.value) === String(this.value))
31
+ },
32
+ currLabel () {
33
+ return this.selectItem ? this.selectItem.label : ''
34
+ },
35
+ styles () {
36
+ return this.selectItem && this.selectItem.color? `background:${this.selectItem.color};` : ''
37
+ }
38
+ }
39
+ }
40
+ </script>
41
+
42
+ <style lang="scss">
43
+ .ml-approval-type {
44
+ display: inline-block;
45
+ color: #ffffff;
46
+ padding: 6rpx 18rpx;
47
+ border-radius: 10rpx;
48
+ font-size: 24rpx;
49
+ }
50
+ </style>
@@ -18,10 +18,23 @@ export default {
18
18
  type: String,
19
19
  default: 'button'
20
20
  },
21
+ redirect: Boolean,
22
+ url: String,
21
23
  className: String
22
24
  },
23
25
  methods: {
24
26
  tapEvent () {
27
+ if (this.url) {
28
+ if (this.redirect) {
29
+ uni.redirectTo({
30
+ url: this.url
31
+ })
32
+ } else {
33
+ uni.navigateTo({
34
+ url: this.url
35
+ })
36
+ }
37
+ }
25
38
  this.$emit('tap', {})
26
39
  },
27
40
  clickEvent () {
@@ -1,7 +1,9 @@
1
1
  <template>
2
2
  <view class="ml-checkbox" :class="[className || '', {'is-checked': checked, 'is-disabled': disabled}]" @tap="tapEvent">
3
- <ml-icon class="checkbox-icon" :name="checked ? 'checkbox-checked' : (indeterminate ? 'checkbox-indeterminate' : 'checkbox-unchecked')"></ml-icon>
4
- <text class="checkbox-content">
3
+ <text class="ml-checkbox-icon">
4
+ <ml-icon :name="checked ? 'checkbox-checked' : (indeterminate ? 'checkbox-indeterminate' : 'checkbox-unchecked')"></ml-icon>
5
+ </text>
6
+ <text class="ml-checkbox-content">
5
7
  <slot>
6
8
  <text>{{ content }}</text>
7
9
  </slot>
@@ -56,7 +58,7 @@ export default {
56
58
  &.is-checked {
57
59
  color: $uni-color-primary;
58
60
  }
59
- .checkbox-icon {
61
+ .ml-checkbox-icon {
60
62
  display: inline-block;
61
63
  width: 40rpx;
62
64
  margin-right: 5rpx;
@@ -47,7 +47,7 @@ export default {
47
47
  display: flex;
48
48
  flex-direction: row;
49
49
  align-items: center;
50
- height: 70rpx;
50
+ height: 80rpx;
51
51
  padding: 0 20rpx ;
52
52
  }
53
53
  .ml-chunk-group-left-icon {
@@ -1,5 +1,5 @@
1
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">
2
+ <view class="ml-chunk-item" :class="[className || '', span && !width ? `span-${span}` : '', align ? `align-${align}` : '', {'is-fixed': width, 'is-vertical': isVertical}]" :style="styles" @click="clickEvent" @tap="tapEvent">
3
3
  <slot></slot>
4
4
  </view>
5
5
  </template>
@@ -29,6 +29,14 @@ export default {
29
29
  styles () {
30
30
  return this.width ? `width: ${this.width};` : ''
31
31
  }
32
+ },
33
+ methods: {
34
+ clickEvent () {
35
+ this.$emit('click', {})
36
+ },
37
+ tapEvent () {
38
+ this.$emit('tap', {})
39
+ }
32
40
  }
33
41
  }
34
42
  </script>
@@ -37,7 +45,7 @@ export default {
37
45
  .ml-chunk-item {
38
46
  display: flex;
39
47
  flex-direction: column;
40
- padding: 10rpx;
48
+ padding: 20rpx 10rpx;
41
49
  line-height: 50rpx;
42
50
  $spans: 4.16667%, 8.33333%, 12.5%, 16.66667%, 20.83333%, 25%, 29.16667%, 33.33333%,
43
51
  37.5%, 41.66667%, 45.83333%, 50%, 54.16667%, 58.33333%, 62.5%, 66.66667%,
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <view class="ml-col" :class="[className || '', 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}` : '', {'is-flex': flex,'is-fixed': width || shrink}]" :style="styles">
3
3
  <slot></slot>
4
4
  </view>
5
5
  </template>
@@ -12,6 +12,8 @@ export default {
12
12
  },
13
13
  props: {
14
14
  span: [String, Number],
15
+ flex: Boolean,
16
+ shrink: Boolean,
15
17
  align: String,
16
18
  width: String,
17
19
  className: String
@@ -29,6 +31,19 @@ export default {
29
31
  $spans: 4.16667%, 8.33333%, 12.5%, 16.66667%, 20.83333%, 25%, 29.16667%, 33.33333%,
30
32
  37.5%, 41.66667%, 45.83333%, 50%, 54.16667%, 58.33333%, 62.5%, 66.66667%,
31
33
  70.83333%, 75%, 79.16667%, 83.33333%, 87.5%, 91.66667%, 95.83333%, 100%;
34
+ &.is-flex {
35
+ display: flex;
36
+ flex-direction: row;
37
+ &.align-left {
38
+ justify-content: left;
39
+ }
40
+ &.align-center {
41
+ justify-content: center;
42
+ }
43
+ &.align-right {
44
+ justify-content: right;
45
+ }
46
+ }
32
47
  &.align-left {
33
48
  text-align: left;
34
49
  }
@@ -1,6 +1,6 @@
1
1
  <template>
2
- <view class="ml-form" :class="[className || '', {'is-vertical': vertical}]">
3
- <uni-forms ref="uniForm" :modelValue="data" :rules="formRules" :label-position="vertical ? 'top' : 'left'">
2
+ <view class="ml-form" :class="[className || '']">
3
+ <uni-forms :key="fKey" ref="uniForm" :modelValue="data" :rules="formRules" :label-position="vertical ? 'top' : 'left'">
4
4
  <slot></slot>
5
5
  </uni-forms>
6
6
  </view>
@@ -19,10 +19,17 @@ export default {
19
19
  items: Array,
20
20
  rules: Object,
21
21
  vertical: Boolean,
22
+ labelWidth: String,
22
23
  className: String
23
24
  },
25
+ provide() {
26
+ return {
27
+ mlForm: this
28
+ }
29
+ },
24
30
  data () {
25
31
  return {
32
+ fKey: 1
26
33
  }
27
34
  },
28
35
  computed: {
@@ -38,6 +45,11 @@ export default {
38
45
  return rest
39
46
  }
40
47
  },
48
+ created () {
49
+ this.$nextTick(() => {
50
+ this.fKey++
51
+ })
52
+ },
41
53
  methods: {
42
54
  matchComponent (item, name) {
43
55
  return item.itemRender && item.itemRender.name === name
@@ -0,0 +1,26 @@
1
+ <template>
2
+ <view class="ml-form-group" :class="className">
3
+ <slot></slot>
4
+ </view>
5
+ </template>
6
+
7
+ <script>
8
+ export default {
9
+ name: 'MlFormItem',
10
+ options: {
11
+ virtualHost: true
12
+ },
13
+ props: {
14
+ className: String
15
+ }
16
+ }
17
+ </script>
18
+
19
+ <style lang="scss">
20
+ .ml-form-group {
21
+ margin: 10rpx 0;
22
+ padding: 20rpx;
23
+ border-radius: 10rpx;
24
+ background: #ffffff;
25
+ }
26
+ </style>
@@ -1,5 +1,11 @@
1
1
  <template>
2
- <uni-forms-item :class="className" :label="title" :name="field">
2
+ <uni-forms-item
3
+ ref="uniFormItem"
4
+ :class="className"
5
+ :label="title"
6
+ :name="field"
7
+ :label-width="itemLabelWidth"
8
+ :label-position="itemVertical">
3
9
  <slot></slot>
4
10
  </uni-forms-item>
5
11
  </template>
@@ -13,7 +19,52 @@ export default {
13
19
  props: {
14
20
  title: String,
15
21
  field: String,
22
+ vertical: {
23
+ type: Boolean,
24
+ default: null
25
+ },
26
+ labelWidth: String,
16
27
  className: String
28
+ },
29
+ inject: {
30
+ form: {
31
+ from: 'mlForm',
32
+ default: null
33
+ }
34
+ },
35
+ computed: {
36
+ itemVertical () {
37
+ let vertical = this.vertical
38
+ if (!vertical) {
39
+ vertical = this.form ? this.form.vertical : ''
40
+ }
41
+ return vertical ? 'top' : 'left'
42
+ },
43
+ itemLabelWidth () {
44
+ let labelWidth = this.labelWidth
45
+ if (!labelWidth) {
46
+ labelWidth = this.form ? this.form.labelWidth : ''
47
+ }
48
+ if (labelWidth && !isNaN(labelWidth)) {
49
+ labelWidth = `${labelWidth}rpx`
50
+ }
51
+ return labelWidth
52
+ }
53
+ },
54
+ created () {
55
+ this.init()
56
+ },
57
+ watch: {
58
+ itemVertical () {
59
+ this.init()
60
+ }
61
+ },
62
+ methods: {
63
+ init () {
64
+ this.$nextTick(() => {
65
+ this.$refs.uniFormItem.localLabelPos = this.itemVertical
66
+ })
67
+ }
17
68
  }
18
69
  }
19
70
  </script>
@@ -10,7 +10,8 @@
10
10
  class="ml-input-inp"
11
11
  autocomplete="off"
12
12
  :placeholder="placeholder"
13
- @input="inputEvent" />
13
+ @input="inputEvent"
14
+ @confirm="confirmEvent"/>
14
15
  <view v-if="suffixIcon" class="ml-input-suffix-icon">
15
16
  <ml-icon :class="suffixIcon"></ml-icon>
16
17
  </view>
@@ -55,6 +56,10 @@ export default {
55
56
  const value = this.inpVal
56
57
  this.$emit('input', value)
57
58
  this.$emit('change', { value })
59
+ },
60
+ confirmEvent () {
61
+ const value = this.inpVal
62
+ this.$emit('confirm', { value })
58
63
  }
59
64
  }
60
65
  }
@@ -64,11 +69,11 @@ export default {
64
69
  .ml-input {
65
70
  display: flex;
66
71
  flex-direction: row;
67
- font-size: $uni-font-size-base;
68
72
  .ml-input-inp {
69
73
  padding: 0 20rpx;
70
74
  height: 70rpx;
71
75
  width: 100%;
76
+ font-size: $uni-font-size-base;
72
77
  }
73
78
  .ml-input-prefix-icon,
74
79
  .ml-input-suffix-icon {
@@ -76,6 +81,7 @@ export default {
76
81
  flex-shrink: 0;
77
82
  align-items: center;
78
83
  border: 1px solid #e5e5e5;
84
+ font-size: 30rpx;
79
85
  }
80
86
  .ml-input-prefix-icon {
81
87
  padding-left: 20rpx;
@@ -0,0 +1,32 @@
1
+ <template>
2
+ <view class="ml-list-group" :class="className">
3
+ <view class="ml-list-group-content">
4
+ <scroll-view scroll-y>
5
+ <slot></slot>
6
+ </scroll-view>
7
+ </view>
8
+ </view>
9
+ </template>
10
+
11
+ <script>
12
+ export default {
13
+ name: 'MlListGroup',
14
+ options: {
15
+ virtualHost: true
16
+ },
17
+ props: {
18
+ title: String,
19
+ className: String
20
+ }
21
+ }
22
+ </script>
23
+
24
+ <style lang="scss">
25
+ .ml-list-group {
26
+ padding: 0 10rpx;
27
+ .ml-list-group-content {
28
+ display: flex;
29
+ flex-direction: column;
30
+ }
31
+ }
32
+ </style>
@@ -0,0 +1,88 @@
1
+ <template>
2
+ <view class="ml-list-item" :class="className" @click="clickEvent" @tap="tapEvent">
3
+ <view v-if="prefixIcon && prefixIcon !== 'none'" class="ml-list-item-left-icon">
4
+ <ml-icon :className="prefixIcon"></ml-icon>
5
+ </view>
6
+ <view class="ml-list-item-content">
7
+ <slot>
8
+ <text>{{ name }}</text>
9
+ </slot>
10
+ </view>
11
+ <view v-if="suffixIcon && suffixIcon !== 'none'" class="ml-list-item-right-icon">
12
+ <ml-icon :className="suffixIcon"></ml-icon>
13
+ </view>
14
+ </view>
15
+ </template>
16
+
17
+ <script>
18
+ export default {
19
+ name: 'MlListItem',
20
+ options: {
21
+ virtualHost: true
22
+ },
23
+ props: {
24
+ name: String,
25
+ prefixIcon: String,
26
+ suffixIcon: {
27
+ type: String,
28
+ default: 'mlicon-arrow-right'
29
+ },
30
+ url: String,
31
+ redirect: Boolean,
32
+ className: String
33
+ },
34
+ methods: {
35
+ clickEvent () {
36
+ this.$emit('click', {})
37
+ },
38
+ tapEvent () {
39
+ if (this.url) {
40
+ if (this.redirect) {
41
+ uni.redirectTo({
42
+ url: this.url
43
+ })
44
+ } else {
45
+ uni.navigateTo({
46
+ url: this.url
47
+ })
48
+ }
49
+ }
50
+ this.$emit('tap', {})
51
+ }
52
+ }
53
+ }
54
+ </script>
55
+
56
+
57
+ <style lang="scss">
58
+ .ml-list-item {
59
+ display: flex;
60
+ flex-direction: row;
61
+ padding: 20rpx;
62
+ margin: 10rpx 0;
63
+ border-radius: 10rpx;
64
+ background: #ffffff;
65
+ .ml-list-item-content {
66
+ display: flex;
67
+ flex-direction: row;
68
+ flex-grow: 1;
69
+ overflow: hidden;
70
+ text-overflow: ellipsis;
71
+ white-space: nowrap;
72
+ }
73
+ .ml-list-item-left-icon,
74
+ .ml-list-item-right-icon {
75
+ display: flex;
76
+ flex-direction: row;
77
+ align-items: center;
78
+ flex-shrink: 0;
79
+ padding: 0 10rpx;
80
+ }
81
+ .ml-list-item-left-icon {
82
+ font-size: 38rpx;
83
+ }
84
+ .ml-list-item-right-icon {
85
+ font-size: 30rpx;
86
+ }
87
+ }
88
+ </style>
@@ -1,8 +1,8 @@
1
1
  <template>
2
- <picker :value="value" class="ml-month-picker" :class="[className || '', {'is-border': border}]" mode="date" fields="month" @change="changeEvent">
3
- <view class="picker-warpper">
4
- <view class="picker-text">{{ value || '请选择' }}</view>
5
- <ml-icon class="picker-icon" name="arrow-down"></ml-icon>
2
+ <picker :value="value" class="ml-month-picker" mode="date" fields="month" @change="changeEvent">
3
+ <view class="ml-month-picker-warpper" :class="[className || '', {'is-border': border}]">
4
+ <view class="ml-month-picker-text">{{ value || '请选择' }}</view>
5
+ <ml-icon class="ml-month-picker-icon" name="arrow-down"></ml-icon>
6
6
  </view>
7
7
  </picker>
8
8
  </template>
@@ -30,34 +30,33 @@ export default {
30
30
 
31
31
  <style lang="scss">
32
32
  .ml-month-picker {
33
- font-size: 14px;
33
+ display: inline-block;
34
+ font-size: $uni-font-size-base;
34
35
  box-sizing: border-box;
35
- border-radius: 4px;
36
- padding: 0 5px;
37
- padding-left: 10px;
36
+ padding: 0;
38
37
  position: relative;
39
- display: flex;
40
38
  user-select: none;
41
39
  flex-direction: row;
42
40
  align-items: center;
43
- height: 35px;
44
- width: 240rpx;
41
+ width: 100%;
45
42
  color: #6a6a6a;
43
+ }
44
+ .ml-month-picker-warpper {
45
+ position: relative;
46
+ display: flex;
47
+ flex-direction: row;
48
+ align-items: center;
49
+ padding: 0 10rpx;
50
+ height: 70rpx;
51
+ border-radius: 10rpx;
46
52
  &.is-border {
47
53
  border: 1px solid #e5e5e5;
48
54
  }
49
- .picker-warpper {
50
- position: relative;
51
- display: flex;
52
- flex-direction: row;
53
- align-items: center;
54
- width: 194rpx;
55
- }
56
- .picker-text {
57
- flex-grow: 1;
58
- }
59
- .picker-icon {
60
- color: #6a6a6a;
61
- }
55
+ }
56
+ .ml-month-picker-text {
57
+ flex-grow: 1;
58
+ }
59
+ .ml-month-picker-icon {
60
+ color: #6a6a6a;
62
61
  }
63
62
  </style>
@@ -1,7 +1,9 @@
1
1
  <template>
2
2
  <view class="ml-radio" :class="[className || '', {'is-checked': checked, 'is-disabled': disabled}]" @tap="tapEvent">
3
- <ml-icon class="radio-icon" :name="checked ? 'radio-checked' : 'radio-unchecked'"></ml-icon>
4
- <text class="radio-content">
3
+ <text class="ml-radio-icon">
4
+ <ml-icon :name="checked ? 'radio-checked' : 'radio-unchecked'"></ml-icon>
5
+ </text>
6
+ <text class="ml-radio-content">
5
7
  <slot>
6
8
  <text>{{ content }}</text>
7
9
  </slot>
@@ -47,7 +49,7 @@ export default {
47
49
  &.is-checked {
48
50
  color: $uni-color-primary;
49
51
  }
50
- .radio-icon {
52
+ .ml-radio-icon {
51
53
  font-size: 1.1em;
52
54
  margin-right: 10rpx;
53
55
  }
@@ -21,6 +21,7 @@ export default {
21
21
  .ml-row {
22
22
  display: flex;
23
23
  flex-direction: row;
24
+ flex-grow: 1;
24
25
  &.is-vertical {
25
26
  flex-direction: column;
26
27
  }
@@ -1,11 +1,13 @@
1
1
  <template>
2
- <picker class="ml-select-picker" :class="[className || '', {'is-border': border}]" :range="optionList" :range-key="optLabelField" @change="changeEvent">
3
- <view class="picker-warpper" :style="{width: width || '160rpx'}">
4
- <view class="picker-text">
2
+ <picker class="ml-select-picker" :style="{width: width || '100%'}" :range="optionList" :range-key="optLabelField" @change="changeEvent">
3
+ <view class="ml-select-picker-warpper" :class="[className || '', {'is-border': border}]">
4
+ <view class="ml-select-picker-text">
5
5
  <text v-if="value !== null">{{ selectName }}</text>
6
6
  <text v-else class="picker-placeholder">{{ placeholder }}</text>
7
7
  </view>
8
- <ml-icon class="picker-icon" name="arrow-down" />
8
+ <view class="ml-select-picker-icon">
9
+ <ml-icon name="arrow-down" />
10
+ </view>
9
11
  </view>
10
12
  </picker>
11
13
  </template>
@@ -76,35 +78,37 @@ export default {
76
78
 
77
79
  <style lang="scss">
78
80
  .ml-select-picker {
81
+ display: inline-block;
79
82
  font-size: $uni-font-size-base;
80
83
  box-sizing: border-box;
81
- border-radius: 8rpx;
82
- padding: 0 10rpx;
83
- padding-left: 20rpx;
84
+ padding: 0;
84
85
  position: relative;
85
- display: inline-flex;;
86
86
  user-select: none;
87
87
  flex-direction: row;
88
88
  align-items: center;
89
- height: 70rpx;
89
+ width: 100%;
90
90
  color: #6a6a6a;
91
+ }
92
+ .ml-select-picker-warpper {
93
+ position: relative;
94
+ display: flex;
95
+ flex-direction: row;
96
+ align-items: center;
97
+ padding: 0 10rpx;
98
+ height: 70rpx;
99
+ border-radius: 10rpx;
91
100
  &.is-border {
92
101
  border: 1px solid #e5e5e5;
93
102
  }
94
- .picker-warpper {
95
- position: relative;
96
- display: flex;
97
- flex-direction: row;
98
- align-items: center;
99
- }
100
- .picker-text {
101
- flex-grow: 1;
102
- overflow: hidden;
103
- text-overflow: ellipsis;
104
- white-space: nowrap;
105
- }
106
- .picker-icon {
107
- color: #6a6a6a;
108
- }
103
+ }
104
+ .ml-select-picker-text {
105
+ flex-grow: 1;
106
+ overflow: hidden;
107
+ text-overflow: ellipsis;
108
+ white-space: nowrap;
109
+ }
110
+ .ml-select-picker-icon {
111
+ display: inline;
112
+ color: #6a6a6a;
109
113
  }
110
114
  </style>
@@ -0,0 +1,52 @@
1
+ <template>
2
+ <view class="ml-status-tag" :class="[className, status ? `status-${status}` : '']" :style="styles">
3
+ <slot>
4
+ <text>{{ content }}</text>
5
+ </slot>
6
+ </view>
7
+ </template>
8
+
9
+ <script>
10
+ export default {
11
+ name: 'MlStatusTag',
12
+ options: {
13
+ virtualHost: true
14
+ },
15
+ props: {
16
+ color: String,
17
+ content: String,
18
+ status: String,
19
+ className: String
20
+ },
21
+ computed: {
22
+ styles () {
23
+ return this.color ? `background:${this.color};` : ''
24
+ }
25
+ }
26
+ }
27
+ </script>
28
+
29
+ <style lang="scss">
30
+ .ml-status-tag {
31
+ display: inline-block;
32
+ color: #ffffff;
33
+ padding: 6rpx 18rpx;
34
+ border-radius: 10rpx;
35
+ font-size: 24rpx;
36
+ &.status-primary {
37
+ background: $uni-color-primary;
38
+ }
39
+ &.status-success {
40
+ background: $uni-color-success;
41
+ }
42
+ &.status-info {
43
+ background: #909399;
44
+ }
45
+ &.status-warning {
46
+ background: $uni-color-warning;
47
+ }
48
+ &.status-danger {
49
+ background: $uni-color-error;
50
+ }
51
+ }
52
+ </style>
@@ -0,0 +1,27 @@
1
+ <template>
2
+ <switch class="ml-switch" :class="className" :checked="value" :color="color" @change="changeEvent"></switch>
3
+ </template>
4
+
5
+ <script>
6
+ export default {
7
+ name: 'MlSwitch',
8
+ options: {
9
+ virtualHost: true
10
+ },
11
+ props: {
12
+ value: Boolean,
13
+ color: {
14
+ type: String,
15
+ default: '#007aff'
16
+ },
17
+ className: String
18
+ },
19
+ methods: {
20
+ changeEvent (e) {
21
+ const value = e.detail.value
22
+ this.$emit('input', value)
23
+ this.$emit('change', { value })
24
+ }
25
+ }
26
+ }
27
+ </script>
@@ -0,0 +1,35 @@
1
+ <template>
2
+ <view v-if="selectTab === name" class="ml-tab-pane" :class="className">
3
+ <slot></slot>
4
+ </view>
5
+ </template>
6
+
7
+ <script>
8
+ export default {
9
+ name: 'MlTabPane',
10
+ options: {
11
+ virtualHost: true
12
+ },
13
+ props: {
14
+ name: [String, Number],
15
+ className: String
16
+ },
17
+ inject: {
18
+ tabs: {
19
+ from: 'mlTabs',
20
+ default: null
21
+ }
22
+ },
23
+ computed: {
24
+ selectTab () {
25
+ return this.tabs ? this.tabs.value : null
26
+ }
27
+ }
28
+ }
29
+ </script>
30
+
31
+ <style lang="scss">
32
+ .ml-tab-pane {
33
+ display: block;
34
+ }
35
+ </style>
@@ -1,10 +1,19 @@
1
1
  <template>
2
2
  <view class="ml-tabs" :class="className">
3
- <scroll-view scroll-x>
4
- <view class="ml-tabs-navs">
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>
6
- </view>
7
- </scroll-view>
3
+ <view class="ml-tabs-header">
4
+ <scroll-view scroll-x>
5
+ <view class="ml-tabs-navs">
6
+ <view class="ml-tabs-nav-item" v-for="(item, index) in options" :key="index" :class="{'is-active': value === item.value}" :style="itemStyles" @tap="changeEvent(item)">
7
+ <view class="ml-tabs-nav-title">{{ item.label }}</view>
8
+ </view>
9
+ </view>
10
+ </scroll-view>
11
+ </view>
12
+ <view class="ml-tabs-content">
13
+ <scroll-view scroll-y>
14
+ <slot></slot>
15
+ </scroll-view>
16
+ </view>
8
17
  </view>
9
18
  </template>
10
19
 
@@ -17,11 +26,22 @@ export default {
17
26
  props: {
18
27
  value: [String, Number],
19
28
  options: Array,
20
- className: String
29
+ className: String,
30
+ itemWidth: String
31
+ },
32
+ provide() {
33
+ return {
34
+ mlTabs: this
35
+ }
21
36
  },
22
37
  data () {
23
38
  return {}
24
39
  },
40
+ computed: {
41
+ itemStyles () {
42
+ return this.itemWidth ? `width:${this.itemWidth};` : ''
43
+ }
44
+ },
25
45
  methods: {
26
46
  changeEvent (item) {
27
47
  const value = item.value
@@ -35,17 +55,21 @@ export default {
35
55
  <style lang="scss">
36
56
  .ml-tabs {
37
57
  .ml-tabs-navs {
38
- display: inline-block;
39
58
  white-space: nowrap;
40
59
  }
41
60
  .ml-tabs-nav-item {
42
61
  position: relative;
43
62
  display: inline-block;
44
- padding: 10rpx 20rpx;
45
- margin: 0 10rpx;
63
+ padding: 10rpx 20rpx 0 20rpx;
64
+ text-align: center;
65
+ .ml-tabs-nav-title {
66
+ padding: 10rpx 20rpx;
67
+ }
46
68
  &.is-active {
47
- color: $uni-color-primary;
48
- border-bottom: 1px solid $uni-color-primary;
69
+ .ml-tabs-nav-title {
70
+ color: $uni-color-primary;
71
+ border-bottom: 2px solid $uni-color-primary;
72
+ }
49
73
  }
50
74
  }
51
75
  }
@@ -1,11 +1,11 @@
1
1
  <template>
2
2
  <view class="ml-textarea" :class="[className || '', {'is-border': border}]">
3
- <view v-if="readonly" class="content">{{ inpVal }}</view>
3
+ <view v-if="readonly" class="ml-textarea-content">{{ inpVal }}</view>
4
4
  <view v-else>
5
- <textarea class="textarea" v-model="inpVal" :rows="rows" :maxlength="maxLength" :placeholder="placeholder" @input="inputEvent" :style="{color: fontColor, height: `${rows * 30}rpx`}"></textarea>
6
- <view v-if="showWordLimit" class="word-count">
7
- <VoiceInput v-if="showVoice" class="word-voice" v-model="inpVal" @input="inputEvent"></VoiceInput>
8
- <view class="word-numbers">{{ value ? value.length : 0 }}/{{ maxLength }}</view>
5
+ <textarea class="ml-textarea-inp" v-model="inpVal" :rows="rows" :maxlength="maxLength" :placeholder="placeholder" @input="inputEvent" :style="{color: fontColor, height: `${rows * 30}rpx`}"></textarea>
6
+ <view v-if="showWordLimit" class="ml-textarea-word-count">
7
+ <VoiceInput v-if="showVoice" v-model="inpVal" @input="inputEvent"></VoiceInput>
8
+ <view class="ml-textarea-word-numbers">{{ value ? value.length : 0 }}/{{ maxLength }}</view>
9
9
  </view>
10
10
  </view>
11
11
  </view>
@@ -80,26 +80,27 @@ export default {
80
80
  <style lang="scss">
81
81
  .ml-textarea {
82
82
  font-size: $uni-font-size-base;
83
- padding: 20rpx 10rpx 10rpx 30rpx;
83
+ padding: 20rpx 10rpx 10rpx 20rpx;
84
84
  &.is-border {
85
85
  border: 1px solid #e5e5e5;
86
86
  border-radius: 10rpx;
87
87
  }
88
- & > .content {
88
+ .ml-textarea-content {
89
89
  width: 100%;
90
90
  overflow: auto;
91
91
  word-break: break-all;
92
92
  }
93
- .textarea {
93
+ .ml-textarea-inp {
94
94
  color: rgba(39, 42, 48, 0.4500);
95
95
  height: 280rpx;
96
96
  width: 100%;
97
+ font-size: $uni-font-size-base;
97
98
  }
98
- .word-count {
99
+ .ml-textarea-word-count {
99
100
  padding-top: 10rpx;
100
101
  display: flex;
101
102
  }
102
- .word-numbers {
103
+ .ml-textarea-word-numbers {
103
104
  flex-grow: 1;
104
105
  color: #999999;
105
106
  text-align: right;
@@ -1,8 +1,8 @@
1
1
  <template>
2
- <picker :value="value" class="ml-year-picker" :class="[className || '', {'is-border': border}]" mode="date" fields="year" @change="changeEvent">
3
- <view class="picker-warpper">
4
- <view class="picker-text">{{ value || '请选择' }}</view>
5
- <ml-icon class="picker-icon" name="arrow-down"></ml-icon>
2
+ <picker :value="value" class="ml-year-picker" mode="date" fields="year" @change="changeEvent">
3
+ <view class="ml-year-picker-warpper" :class="[className || '', {'is-border': border}]">
4
+ <view class="ml-year-picker-text">{{ value || '请选择' }}</view>
5
+ <ml-icon class="ml-year-picker-icon" name="arrow-down"></ml-icon>
6
6
  </view>
7
7
  </picker>
8
8
  </template>
@@ -30,34 +30,33 @@ export default {
30
30
 
31
31
  <style lang="scss">
32
32
  .ml-year-picker {
33
- font-size: 14px;
33
+ display: inline-block;
34
+ font-size: $uni-font-size-base;
34
35
  box-sizing: border-box;
35
- border-radius: 4px;
36
- padding: 0 5px;
37
- padding-left: 10px;
36
+ padding: 0;
38
37
  position: relative;
39
- display: flex;
40
38
  user-select: none;
41
39
  flex-direction: row;
42
40
  align-items: center;
43
- height: 35px;
44
- width: 240rpx;
41
+ width: 100%;
45
42
  color: #6a6a6a;
43
+ }
44
+ .ml-year-picker-warpper {
45
+ position: relative;
46
+ display: flex;
47
+ flex-direction: row;
48
+ align-items: center;
49
+ padding: 0 10rpx;
50
+ height: 70rpx;
51
+ border-radius: 10rpx;
46
52
  &.is-border {
47
53
  border: 1px solid #e5e5e5;
48
54
  }
49
- .picker-warpper {
50
- position: relative;
51
- display: flex;
52
- flex-direction: row;
53
- align-items: center;
54
- width: 194rpx;
55
- }
56
- .picker-text {
57
- flex-grow: 1;
58
- }
59
- .picker-icon {
60
- color: #6a6a6a;
61
- }
55
+ }
56
+ .ml-year-picker-text {
57
+ flex-grow: 1;
58
+ }
59
+ .ml-year-picker-icon {
60
+ color: #6a6a6a;
62
61
  }
63
62
  </style>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mali-applet-ui",
3
- "version": "0.0.36",
3
+ "version": "0.0.39",
4
4
  "description": "码里云小程序组件库",
5
5
  "files": [
6
6
  "components",
@@ -1,33 +0,0 @@
1
- <template>
2
- <view class="ml-fixed-bottom" :class="[className || '']" :style="styles">
3
- <slot></slot>
4
- </view>
5
- </template>
6
-
7
- <script>
8
- export default {
9
- name: 'MlFixedBottom',
10
- options: {
11
- virtualHost: true
12
- },
13
- props: {
14
- bottom: String,
15
- className: String
16
- },
17
- computed: {
18
- styles () {
19
- return this.bottom ? `bottom:${this.bottom};` : ''
20
- }
21
- }
22
- }
23
- </script>
24
-
25
- <style lang="scss">
26
- .ml-fixed-bottom {
27
- display: flex;
28
- flex-direction: row;
29
- position: fixed;
30
- width: 100%;
31
- bottom: 40rpx;
32
- }
33
- </style>