index.js
2.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/*
基础组件props属性全局配置文件。优先级:全局配置文件props < 单独设置组件props
温馨提示:未设置则使用组件内默认值,避免出错,请勿删减以下配置
组件属性介绍请查看文档
*/
//组件内主色配置
const color = {
primary: '#577ee3',
success: '#07c160',
warning: '#ff7900',
danger: '#EB0909',
pink: '#f74d54',
blue: '#007AFF',
link: '#586c94'
}
const propsConfig = {
//组件内主色配置
color,
//组件名称,字体图标组件 tui-icon
tuiIcon: {
//组件属性值
size: 32,
unit: 'px',
color: '#999'
},
//按钮组件 tui-button
tuiButton: {
height: '96rpx',
size: 32
},
//列表项组件 tui-list-cell
tuiListCell: {
arrowColor: '#c0c0c0',
lineColor: '#eaeef1',
lineLeft: 30,
padding: '26rpx 44rpx',
color: '#333',
size: 28
},
//按钮组件 tui-form-button
tuiFormButton: {
background: color.primary,
color: '#fff',
height: '96rpx',
size: 32,
radius: '6rpx'
},
//文本组件 tui-text
tuiText: {
size: 28,
unit: 'rpx',
color: ''
},
//输入框组件 tui-input
tuiInput: {
requiredColor: color.danger,
labelSize: 28,
labelColor: '#333',
size: 28,
color: '#333',
padding: '26rpx 30rpx',
backgroundColor: '#FFFFFF',
radius: 0
},
//表单项组件 tui-form-item
tuiFormItem: {
padding: '28rpx 30rpx',
labelSize: 28,
labelColor: '#333',
labelFontWeight: 400,
asteriskColor: color.danger,
background: '#fff',
arrowColor: '#c0c0c0',
borderColor: '#eaeef1',
radius: '0rpx',
position: 2
},
//表单校验组件 tui-form
tuiForm: {
tipBackgroundColor: color.pink,
duration: 2000
},
//全局方法,调用 uni.$tui.toast
toast(text, duration, success) {
uni.showToast({
// #ifndef MP-ALIPAY
duration: duration || 2000,
// #endif
title: text || "出错啦~",
icon: success ? 'success' : 'none'
})
},
modal(title, content, showCancel, callback, confirmColor, confirmText) {
uni.showModal({
title: title || '提示',
content: content,
showCancel: showCancel,
cancelColor: "#555",
confirmColor: confirmColor || color.primary,
confirmText: confirmText || "确定",
success(res) {
if (res.confirm) {
callback && callback(true)
} else {
callback && callback(false)
}
}
})
},
//跳转页面
href(url, isMain) {
if(isMain == 1) {
uni.switchTab({url: url})
} else if(isMain == 2) {
uni.redirectTo({url: url})
} else if(isMain == 3) {
uni.reLaunch({url: url})
} else {
uni.navigateTo({url: url})
}
},
rpx2px(value) {
return uni.upx2px(value)
}
}
export default propsConfig