mali-applet-ui 1.1.18 → 1.1.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/i18n/i18n.js +44 -0
- package/i18n/lang/en_US.js +25 -0
- package/i18n/lang/zh_CN.js +25 -0
- package/lib/components/ml-drawer/ml-drawer.vue +7 -4
- package/lib/components/ml-form-group/ml-form-group.vue +8 -1
- package/lib/components/ml-form-item/ml-form-item.vue +5 -1
- package/lib/components/ml-input/ml-input.vue +5 -3
- package/lib/components/ml-load-more/ml-load-more.vue +5 -3
- package/lib/components/ml-not-data/ml-not-data.vue +6 -2
- package/lib/components/ml-select-picker/ml-select-picker.vue +18 -6
- package/lib/components/ml-textarea/ml-textarea.vue +5 -3
- package/modal/loading.js +3 -1
- package/modal/modal.js +6 -5
- package/modal/toast.js +4 -3
- package/package.json +2 -1
package/i18n/i18n.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import XEUtils from 'xe-utils'
|
|
2
|
+
import MaliStorage from '../storage'
|
|
3
|
+
|
|
4
|
+
import zhCN from './lang/zh_CN'
|
|
5
|
+
import enUS from './lang/en_US'
|
|
6
|
+
|
|
7
|
+
const compMessage = {
|
|
8
|
+
zh_CN: zhCN,
|
|
9
|
+
en_US: enUS
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const sysLang = uni.getSystemInfoSync().language
|
|
13
|
+
let currLanguage = MaliStorage.getItem('MALI_LANGUAGE') || (/en/i.test(sysLang) ? 'en_US' : 'zh_CN')
|
|
14
|
+
|
|
15
|
+
const localeMessage = {}
|
|
16
|
+
|
|
17
|
+
const MaliI18n = {
|
|
18
|
+
getLanguage () {
|
|
19
|
+
return currLanguage
|
|
20
|
+
},
|
|
21
|
+
setLanguage (language) {
|
|
22
|
+
if (localeMessage[language]) {
|
|
23
|
+
currLanguage = language
|
|
24
|
+
MaliStorage.setItem('MALI_LANGUAGE', language)
|
|
25
|
+
} else {
|
|
26
|
+
console.error(`国际化 ${language} 不存在`)
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
setLocaleMessage (language, message) {
|
|
30
|
+
localeMessage[language] = Object.assign({}, compMessage[language], message)
|
|
31
|
+
},
|
|
32
|
+
t (key, args) {
|
|
33
|
+
if (key && key.indexOf && key.indexOf('.') > -1) {
|
|
34
|
+
const str = XEUtils.toFormatString(XEUtils.get(localeMessage[currLanguage], key), args)
|
|
35
|
+
return str || XEUtils.isNumber(str) ? str : key
|
|
36
|
+
}
|
|
37
|
+
return key
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// 组件默认语言
|
|
42
|
+
MaliI18n.setLocaleMessage(currLanguage, compMessage[currLanguage])
|
|
43
|
+
|
|
44
|
+
export default MaliI18n
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
ml: {
|
|
3
|
+
base: {
|
|
4
|
+
all: 'All',
|
|
5
|
+
pleaseSelect: 'Please select'
|
|
6
|
+
},
|
|
7
|
+
loading: {
|
|
8
|
+
loading: 'Loading'
|
|
9
|
+
},
|
|
10
|
+
toast: {
|
|
11
|
+
success: 'Successful operation',
|
|
12
|
+
fail: 'Operation failure'
|
|
13
|
+
},
|
|
14
|
+
modal: {
|
|
15
|
+
sysTitle: 'System message',
|
|
16
|
+
confirm: 'Confirm',
|
|
17
|
+
cancel: 'Cancel'
|
|
18
|
+
},
|
|
19
|
+
mlLoadMore: {
|
|
20
|
+
loading: 'Loading...',
|
|
21
|
+
loadMore: 'Pull up to show more',
|
|
22
|
+
notMore: 'No more data'
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
ml: {
|
|
3
|
+
base: {
|
|
4
|
+
all: '全部',
|
|
5
|
+
pleaseSelect: '请选择',
|
|
6
|
+
confirm: '确认',
|
|
7
|
+
cancel: '取消'
|
|
8
|
+
},
|
|
9
|
+
loading: {
|
|
10
|
+
loading: '加载中'
|
|
11
|
+
},
|
|
12
|
+
toast: {
|
|
13
|
+
success: '操作成功',
|
|
14
|
+
error: '操作失败'
|
|
15
|
+
},
|
|
16
|
+
modal: {
|
|
17
|
+
sysTitle: '系统提示'
|
|
18
|
+
},
|
|
19
|
+
mlLoadMore: {
|
|
20
|
+
loading: '正在加载中...',
|
|
21
|
+
loadMore: '上拉显示更多',
|
|
22
|
+
notMore: '没有更多数据了'
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
</view>
|
|
14
14
|
<view v-if="showConfirmButton || showCancelButton || showFooter" class="ml-drawer-footer">
|
|
15
15
|
<slot name="footer">
|
|
16
|
-
<ml-button v-if="showCancelButton" :status="cancelButtonStatus" @click="cancelEvent">{{ cancelButtonText }}</ml-button>
|
|
17
|
-
<ml-button v-if="showConfirmButton" :status="confirmButtonStatus" @click="confirmEvent">{{ confirmButtonText }}</ml-button>
|
|
16
|
+
<ml-button v-if="showCancelButton" :status="cancelButtonStatus" @click="cancelEvent">{{ translate(cancelButtonText) }}</ml-button>
|
|
17
|
+
<ml-button v-if="showConfirmButton" :status="confirmButtonStatus" @click="confirmEvent">{{ translate(confirmButtonText) }}</ml-button>
|
|
18
18
|
</slot>
|
|
19
19
|
</view>
|
|
20
20
|
</view>
|
|
@@ -22,6 +22,8 @@
|
|
|
22
22
|
</template>
|
|
23
23
|
|
|
24
24
|
<script>
|
|
25
|
+
import MaliI18n from '../../../i18n/i18n'
|
|
26
|
+
|
|
25
27
|
export default {
|
|
26
28
|
name: 'MlDrawer',
|
|
27
29
|
props: {
|
|
@@ -46,14 +48,14 @@ export default {
|
|
|
46
48
|
},
|
|
47
49
|
confirmButtonText: {
|
|
48
50
|
type: String,
|
|
49
|
-
default: '
|
|
51
|
+
default: 'ml.base.confirm'
|
|
50
52
|
},
|
|
51
53
|
confirmClosable: Boolean,
|
|
52
54
|
showCancelButton: Boolean,
|
|
53
55
|
cancelButtonStatus: String,
|
|
54
56
|
cancelButtonText: {
|
|
55
57
|
type: String,
|
|
56
|
-
default: '
|
|
58
|
+
default: 'ml.base.cancel'
|
|
57
59
|
},
|
|
58
60
|
cancelClosable: {
|
|
59
61
|
type: Boolean,
|
|
@@ -94,6 +96,7 @@ export default {
|
|
|
94
96
|
})
|
|
95
97
|
},
|
|
96
98
|
methods: {
|
|
99
|
+
translate: MaliI18n.t,
|
|
97
100
|
close () {
|
|
98
101
|
clearTimeout(this.animateTime)
|
|
99
102
|
this.isAnimate = true
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
<view class="ml-form-group" :class="className || ''">
|
|
3
3
|
<view v-if="title || showHeader" class="ml-form-group-header">
|
|
4
4
|
<view class="ml-form-group-title">
|
|
5
|
-
<slot name="title">
|
|
5
|
+
<slot name="title">
|
|
6
|
+
<view>{{ translate(title) }}</view>
|
|
7
|
+
</slot>
|
|
6
8
|
</view>
|
|
7
9
|
<view class="ml-form-group-extra">
|
|
8
10
|
<slot name="extra"></slot>
|
|
@@ -15,6 +17,8 @@
|
|
|
15
17
|
</template>
|
|
16
18
|
|
|
17
19
|
<script>
|
|
20
|
+
import MaliI18n from '../../../i18n/i18n'
|
|
21
|
+
|
|
18
22
|
export default {
|
|
19
23
|
name: 'MlFormGroup',
|
|
20
24
|
options: {
|
|
@@ -24,6 +28,9 @@ export default {
|
|
|
24
28
|
title: String,
|
|
25
29
|
showHeader: Boolean,
|
|
26
30
|
className: String
|
|
31
|
+
},
|
|
32
|
+
methods: {
|
|
33
|
+
translate: MaliI18n.t
|
|
27
34
|
}
|
|
28
35
|
}
|
|
29
36
|
</script>
|
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
<view v-if="title || $slots.title" class="ml-form-item-header" :style="titleStyle">
|
|
7
7
|
<view v-if="isRequired" class="ml-form-item-header-asterisk">*</view>
|
|
8
8
|
<view class="ml-form-item-header-title">
|
|
9
|
-
<slot name="title">
|
|
9
|
+
<slot name="title">
|
|
10
|
+
<view>{{ translate(title) }}</view>
|
|
11
|
+
</slot>
|
|
10
12
|
</view>
|
|
11
13
|
<view class="ml-form-item-header-extra">
|
|
12
14
|
<slot name="extra"></slot>
|
|
@@ -33,6 +35,7 @@
|
|
|
33
35
|
|
|
34
36
|
<script>
|
|
35
37
|
import XEUtils from 'xe-utils'
|
|
38
|
+
import MaliI18n from '../../../i18n/i18n'
|
|
36
39
|
|
|
37
40
|
export default {
|
|
38
41
|
name: 'MlFormItem',
|
|
@@ -195,6 +198,7 @@ export default {
|
|
|
195
198
|
}
|
|
196
199
|
},
|
|
197
200
|
methods: {
|
|
201
|
+
translate: MaliI18n.t,
|
|
198
202
|
updateProp (prop) {
|
|
199
203
|
if (this.form) {
|
|
200
204
|
const item = this.form.itemList.find(item => item.mId === this.mId)
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<view v-else-if="!editable && (platformEnv.isWXMP || platformEnv.isQWMP)" class="ml-input not-edit" :class="[className || '', {'is-right': align === 'right', 'is-border': border, 'is-disabled': isFormDisabled}]" @tap="tapEvent">
|
|
6
6
|
<view class="ml-input-simulate">
|
|
7
7
|
<text v-if="inpVal">{{ inpVal }}</text>
|
|
8
|
-
<text v-else class="ml-input-placeholder">{{ placeholder }}</text>
|
|
8
|
+
<text v-else class="ml-input-placeholder">{{ translate(placeholder) }}</text>
|
|
9
9
|
</view>
|
|
10
10
|
</view>
|
|
11
11
|
<view v-else class="ml-input" :class="[className || '', {'is-right': align === 'right', 'is-border': border, 'is-prefix': hasPrefix || type === 'search', 'is-suffix': hasSuffix, 'is-disabled': isFormDisabled, 'is-clear': clearable && inpVal}]">
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
:autocomplete="autocomplete"
|
|
22
22
|
:type="type"
|
|
23
23
|
:confirm-type="type === 'search' ? 'search' : 'done'"
|
|
24
|
-
:placeholder="placeholder"
|
|
24
|
+
:placeholder="translate(placeholder)"
|
|
25
25
|
:maxlength="maxlength"
|
|
26
26
|
:disabled="isFormDisabled"
|
|
27
27
|
@tap="tapEvent"
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
|
|
43
43
|
<script>
|
|
44
44
|
import MaliUtils from '../../../utils'
|
|
45
|
+
import MaliI18n from '../../../i18n/i18n'
|
|
45
46
|
import XEUtils from 'xe-utils'
|
|
46
47
|
|
|
47
48
|
export default {
|
|
@@ -73,7 +74,7 @@ export default {
|
|
|
73
74
|
},
|
|
74
75
|
placeholder: {
|
|
75
76
|
type: String,
|
|
76
|
-
default: '
|
|
77
|
+
default: 'ml.base.pleaseSelect'
|
|
77
78
|
},
|
|
78
79
|
maxlength: {
|
|
79
80
|
type: [String, Number],
|
|
@@ -126,6 +127,7 @@ export default {
|
|
|
126
127
|
this.inpVal = XEUtils.toValueString(this.value)
|
|
127
128
|
},
|
|
128
129
|
methods: {
|
|
130
|
+
translate: MaliI18n.t,
|
|
129
131
|
inputEvent () {
|
|
130
132
|
const value = this.inpVal
|
|
131
133
|
this.$emit('input', value)
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
<view v-else-if="showPage" class="ml-load-more-warpper">
|
|
15
15
|
<view v-if="loading" class="ml-load-more-loading">
|
|
16
16
|
<ml-icon name="loading" roll />
|
|
17
|
-
<text class="ml-load-more-loading-text"
|
|
17
|
+
<text class="ml-load-more-loading-text">{{ translate('ml.mlLoadMore.loading') }}</text>
|
|
18
18
|
</view>
|
|
19
19
|
<template v-else>
|
|
20
|
-
<view v-if="loadStatus === 'more'" class="ml-load-more-status-more"
|
|
21
|
-
<view v-if="loadStatus === 'noMore'" class="ml-load-more-status-no-more"
|
|
20
|
+
<view v-if="loadStatus === 'more'" class="ml-load-more-status-more">{{ translate('ml.mlLoadMore.loadMore') }}</view>
|
|
21
|
+
<view v-if="loadStatus === 'noMore'" class="ml-load-more-status-no-more">{{ translate('ml.mlLoadMore.notMore') }}</view>
|
|
22
22
|
</template>
|
|
23
23
|
</view>
|
|
24
24
|
</view>
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
|
|
27
27
|
<script>
|
|
28
28
|
import globalStore from '../../../config/store'
|
|
29
|
+
import MaliI18n from '../../../i18n/i18n'
|
|
29
30
|
import XEUtils from 'xe-utils'
|
|
30
31
|
|
|
31
32
|
export default {
|
|
@@ -98,6 +99,7 @@ export default {
|
|
|
98
99
|
})
|
|
99
100
|
},
|
|
100
101
|
methods: {
|
|
102
|
+
translate: MaliI18n.t,
|
|
101
103
|
getParams () {
|
|
102
104
|
return this.showPage
|
|
103
105
|
? {
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
</view>
|
|
14
14
|
<view v-if="emptyHint || $slots.hint" class="ml-not-data-hint">
|
|
15
15
|
<slot name="hint">
|
|
16
|
-
<
|
|
16
|
+
<view>{{ translate(emptyHint) }}</view>
|
|
17
17
|
</slot>
|
|
18
18
|
</view>
|
|
19
19
|
<view class="ml-not-data-contnet">
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
|
|
26
26
|
<script>
|
|
27
27
|
import globalStore from '../../../config/store'
|
|
28
|
+
import MaliI18n from '../../../i18n/i18n'
|
|
28
29
|
|
|
29
30
|
export default {
|
|
30
31
|
name: 'MlNotData',
|
|
@@ -38,8 +39,11 @@ export default {
|
|
|
38
39
|
return this.emptyUrl || globalStore.notData.emptyUrl
|
|
39
40
|
},
|
|
40
41
|
emptyContentText () {
|
|
41
|
-
return this.emptyText || globalStore.notData.emptyText
|
|
42
|
+
return MaliI18n.t(this.emptyText || globalStore.notData.emptyText)
|
|
42
43
|
}
|
|
44
|
+
},
|
|
45
|
+
methods: {
|
|
46
|
+
translate: MaliI18n.t
|
|
43
47
|
}
|
|
44
48
|
}
|
|
45
49
|
</script>
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<view class="ml-select-picker-warpper" :class="[className || '', {'is-border': border, 'is-clear': value !== null}]">
|
|
7
7
|
<view class="ml-select-picker-text">
|
|
8
8
|
<view v-if="value !== null" class="ml-select-picker-label">{{ selectLabel }}</view>
|
|
9
|
-
<view v-else class="ml-select-picker-placeholder">{{ placeholder }}</view>
|
|
9
|
+
<view v-else class="ml-select-picker-placeholder">{{ translate(placeholder) }}</view>
|
|
10
10
|
</view>
|
|
11
11
|
<view v-if="clearable && value !== null" class="ml-select-picker-clear-icon" @click.stop="clearEvent">
|
|
12
12
|
<ml-icon name="delete-filling"></ml-icon>
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
|
|
21
21
|
<script>
|
|
22
22
|
import XEUtils from 'xe-utils'
|
|
23
|
+
import MaliI18n from '../../../i18n/i18n'
|
|
23
24
|
|
|
24
25
|
export default {
|
|
25
26
|
name: 'MlSelectPicker',
|
|
@@ -31,7 +32,7 @@ export default {
|
|
|
31
32
|
border: Boolean,
|
|
32
33
|
placeholder: {
|
|
33
34
|
type: String,
|
|
34
|
-
default: '
|
|
35
|
+
default: 'ml.base.pleaseSelect'
|
|
35
36
|
},
|
|
36
37
|
disabled: Boolean,
|
|
37
38
|
clearable: Boolean,
|
|
@@ -75,16 +76,26 @@ export default {
|
|
|
75
76
|
if (this.isAll) {
|
|
76
77
|
return [
|
|
77
78
|
{
|
|
78
|
-
[this.optLabelField]: '
|
|
79
|
+
[this.optLabelField]: MaliI18n.t('ml.base.all'),
|
|
79
80
|
[this.optValueField]: ''
|
|
80
81
|
}
|
|
81
|
-
].concat(this.options
|
|
82
|
+
].concat(this.options.map(item => {
|
|
83
|
+
return {
|
|
84
|
+
[this.optLabelField]: MaliI18n.t(item[this.optLabelField]),
|
|
85
|
+
[this.optValueField]: item[this.optValueField]
|
|
86
|
+
}
|
|
87
|
+
}))
|
|
82
88
|
}
|
|
83
|
-
return this.options
|
|
89
|
+
return this.options.map(item => {
|
|
90
|
+
return {
|
|
91
|
+
[this.optLabelField]: MaliI18n.t(item[this.optLabelField]),
|
|
92
|
+
[this.optValueField]: item[this.optValueField]
|
|
93
|
+
}
|
|
94
|
+
})
|
|
84
95
|
},
|
|
85
96
|
selectLabel () {
|
|
86
97
|
const item = this.optionList.find(item => String(item[this.optValueField]) === String(this.value))
|
|
87
|
-
return XEUtils.toValueString(item ? item[this.optLabelField] : this.value)
|
|
98
|
+
return MaliI18n.t(XEUtils.toValueString(item ? item[this.optLabelField] : this.value))
|
|
88
99
|
},
|
|
89
100
|
optOptions () {
|
|
90
101
|
return Object.assign({}, this.optionProps)
|
|
@@ -108,6 +119,7 @@ export default {
|
|
|
108
119
|
this.updateSelectStatus()
|
|
109
120
|
},
|
|
110
121
|
methods: {
|
|
122
|
+
translate: MaliI18n.t,
|
|
111
123
|
updateSelectStatus () {
|
|
112
124
|
const index = XEUtils.findIndexOf(this.optionList, item => String(item[this.optValueField]) === String(this.value))
|
|
113
125
|
this.selectIndex = index === -1 ? 0 : index
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<view v-else-if="!editable && (platformEnv.isWXMP || platformEnv.isQWMP)" class="ml-textarea not-edit" :class="[className || '', {'is-right': align === 'right', 'is-border': border}]">
|
|
6
6
|
<view class="ml-textarea-simulate" :style="{color: fontColor, height: `${rows * 30}rpx`}">
|
|
7
7
|
<text v-if="inpVal">{{ inpVal }}</text>
|
|
8
|
-
<text v-else class="ml-textarea-placeholder">{{ placeholder }}</text>
|
|
8
|
+
<text v-else class="ml-textarea-placeholder">{{ translate(placeholder) }}</text>
|
|
9
9
|
</view>
|
|
10
10
|
<view v-if="showWordLimit && !disabled" class="ml-textarea-word-count">
|
|
11
11
|
<!-- <VoiceInput v-if="showVoice" v-model="inpVal" @input="inputEvent"></VoiceInput> -->
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
v-model="inpVal"
|
|
20
20
|
:rows="rows"
|
|
21
21
|
:maxlength="maxLength"
|
|
22
|
-
:placeholder="placeholder"
|
|
22
|
+
:placeholder="translate(placeholder)"
|
|
23
23
|
:disabled="disabled"
|
|
24
24
|
:show-count="false"
|
|
25
25
|
@input="inputEvent"
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
|
|
37
37
|
<script>
|
|
38
38
|
import MaliUtils from '../../../utils'
|
|
39
|
+
import MaliI18n from '../../../i18n/i18n'
|
|
39
40
|
import XEUtils from 'xe-utils'
|
|
40
41
|
// import VoiceInput from './voice-input.vue'
|
|
41
42
|
|
|
@@ -64,7 +65,7 @@ export default {
|
|
|
64
65
|
},
|
|
65
66
|
placeholder: {
|
|
66
67
|
type: String,
|
|
67
|
-
default: '
|
|
68
|
+
default: 'ml.base.pleaseSelec'
|
|
68
69
|
},
|
|
69
70
|
showWordLimit: {
|
|
70
71
|
type: Boolean,
|
|
@@ -111,6 +112,7 @@ export default {
|
|
|
111
112
|
this.inpVal = XEUtils.toValueString(this.value)
|
|
112
113
|
},
|
|
113
114
|
methods: {
|
|
115
|
+
translate: MaliI18n.t,
|
|
114
116
|
inputEvent () {
|
|
115
117
|
let value = this.inpVal
|
|
116
118
|
if (this.maxLength && value && value.length > this.maxLength) {
|
package/modal/loading.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import MaliI18n from '../i18n/i18n'
|
|
2
|
+
|
|
1
3
|
const MaliLoading = {
|
|
2
4
|
show (option = {}) {
|
|
3
5
|
return new Promise(resolve => {
|
|
4
6
|
uni.showLoading({
|
|
5
|
-
title: option.content || '
|
|
7
|
+
title: MaliI18n.t(option.content || 'ml.loading.loading'),
|
|
6
8
|
success: resolve
|
|
7
9
|
})
|
|
8
10
|
})
|
package/modal/modal.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import XEUtils from 'xe-utils'
|
|
2
|
+
import MaliI18n from '../i18n/i18n'
|
|
2
3
|
|
|
3
4
|
const MaliModal = {
|
|
4
5
|
alert (option) {
|
|
5
6
|
const opts = XEUtils.isString(option) ? { content: option } : (option || {})
|
|
6
7
|
return new Promise(resolve => {
|
|
7
8
|
uni.showModal({
|
|
8
|
-
title: opts.title || '
|
|
9
|
+
title: MaliI18n.t(opts.title || 'ml.modal.sysTitle'),
|
|
9
10
|
content: opts.content || '',
|
|
10
11
|
showCancel: false,
|
|
11
|
-
confirmText: opts.confirmButtonText || '
|
|
12
|
+
confirmText: MaliI18n.t(opts.confirmButtonText || 'ml.base.confirm'),
|
|
12
13
|
success () {
|
|
13
14
|
const type = 'confirm'
|
|
14
15
|
resolve(type)
|
|
@@ -20,11 +21,11 @@ const MaliModal = {
|
|
|
20
21
|
const opts = XEUtils.isString(option) ? { content: option } : (option || {})
|
|
21
22
|
return new Promise(resolve => {
|
|
22
23
|
uni.showModal({
|
|
23
|
-
title: opts.title || '
|
|
24
|
+
title: MaliI18n.t(opts.title || 'ml.modal.sysTitle'),
|
|
24
25
|
content: opts.content || '',
|
|
25
26
|
showCancel: true,
|
|
26
|
-
confirmText: opts.confirmButtonText || '
|
|
27
|
-
cancelText: opts.cancelButtonText || '
|
|
27
|
+
confirmText: MaliI18n.t(opts.confirmButtonText || 'ml.base.confirm'),
|
|
28
|
+
cancelText: MaliI18n.t(opts.cancelButtonText || 'ml.base.cancel'),
|
|
28
29
|
success (res) {
|
|
29
30
|
let type
|
|
30
31
|
if (res.confirm) {
|
package/modal/toast.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import MaliI18n from '../i18n/i18n'
|
|
1
2
|
import XEUtils from 'xe-utils'
|
|
2
3
|
|
|
3
4
|
const MaliToast = {
|
|
@@ -5,7 +6,7 @@ const MaliToast = {
|
|
|
5
6
|
const opts = XEUtils.isString(option) ? { content: option } : (option || {})
|
|
6
7
|
return new Promise(resolve => {
|
|
7
8
|
uni.showToast({
|
|
8
|
-
title: opts.content || '
|
|
9
|
+
title: MaliI18n.t(opts.content || 'ml.toast.success'),
|
|
9
10
|
icon: 'success',
|
|
10
11
|
success () {
|
|
11
12
|
setTimeout(resolve, 2000)
|
|
@@ -17,7 +18,7 @@ const MaliToast = {
|
|
|
17
18
|
const opts = XEUtils.isString(option) ? { content: option } : (option || {})
|
|
18
19
|
return new Promise(resolve => {
|
|
19
20
|
uni.showToast({
|
|
20
|
-
title: opts.content || '
|
|
21
|
+
title: MaliI18n.t(opts.content || 'ml.toast.fail'),
|
|
21
22
|
icon: 'error',
|
|
22
23
|
success () {
|
|
23
24
|
setTimeout(resolve, 2000)
|
|
@@ -29,7 +30,7 @@ const MaliToast = {
|
|
|
29
30
|
const opts = XEUtils.isString(option) ? { content: option } : (option || {})
|
|
30
31
|
return new Promise(resolve => {
|
|
31
32
|
uni.showToast({
|
|
32
|
-
title: opts.content || '
|
|
33
|
+
title: MaliI18n.t(opts.content || 'ml.toast.fail'),
|
|
33
34
|
icon: 'error',
|
|
34
35
|
success () {
|
|
35
36
|
setTimeout(resolve, 2000)
|