mali-applet-ui 0.0.34 → 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.
@@ -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>
@@ -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>
@@ -3,7 +3,7 @@
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>
@@ -46,6 +46,9 @@ export default {
46
46
  })
47
47
  }
48
48
  },
49
+ getDotNum (num) {
50
+ return num > 99 ? '99+' : num
51
+ },
49
52
  tapEvent (option) {
50
53
  const value = option.value
51
54
  this.updateTitle(option)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mali-applet-ui",
3
- "version": "0.0.34",
3
+ "version": "0.0.35",
4
4
  "description": "码里云小程序组件库",
5
5
  "files": [
6
6
  "components",
@@ -1,79 +0,0 @@
1
- <template>
2
- <view class="ml-list-menu" :class="className" @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
- className: String
30
- },
31
- methods: {
32
- clickEvent () {
33
- this.$emit('click', {})
34
- },
35
- tapEvent () {
36
- if (this.url) {
37
- if (this.redirect) {
38
- uni.redirectTo({
39
- url: this.url
40
- })
41
- } else {
42
- uni.navigateTo({
43
- url: this.url
44
- })
45
- }
46
- }
47
- this.$emit('tap', {})
48
- }
49
- }
50
- }
51
- </script>
52
-
53
- <style lang="scss">
54
- .ml-list-menu {
55
- display: flex;
56
- flex-direction: row;
57
- border-bottom: 1px solid #e5e5e5;
58
- line-height: 90rpx;
59
- font-size: 30rpx;
60
- padding: 0 20rpx;
61
- .ml-list-menu-content {
62
- flex-grow: 1;
63
- overflow: hidden;
64
- text-overflow: ellipsis;
65
- white-space: nowrap;
66
- }
67
- .ml-list-menu-left-icon,
68
- .ml-list-menu-right-icon {
69
- flex-shrink: 0;
70
- padding: 0 10rpx;
71
- }
72
- .ml-list-menu-left-icon {
73
- font-size: 38rpx;
74
- }
75
- .ml-list-menu-right-icon {
76
- font-size: 30rpx;
77
- }
78
- }
79
- </style>