diff --git a/unitool.js b/unitool.js index 16d6cdd..7e88c2d 100644 --- a/unitool.js +++ b/unitool.js @@ -4,14 +4,29 @@ import './ican-H5Api.js' // 对齐H5Api: https://ext.dcloud.net.cn/plugin?id=415 const BASE_TYPE_DEFAULT = 'SERVER' // one of { SERVER: 服务器, UNICLOUD_FUNC: 云函数, UNICLOUD_OBJECT: 云对象 } export default { - // 用直观的色彩,代替 uview 的命名方式: - RED: 'error', - GREEN: 'success', - BLUE: 'primary', - YELLOW: 'warning', - GREY: 'info', - BLACK_TOAST: 'default', - WHITE_BUTTON: 'default', + // 用直观的色彩,代替语义化的类型: + // uView 中大量组件都使用 type 来设置颜色,而 uni-ui 中只有少量组件用到。 + c2t: { + RED: 'error', + GREEN: 'success', + BLUE: 'primary', + YELLOW: 'warning', + GREY: 'info', + + uAlertTips: { YELLOW: 'warning', BLUE: 'primary', RED: 'error', GREY: 'info', GREEN: 'success' }, + uBadge: { RED: 'error', BLUE: 'primary', YELLOW: 'warning', GREY: 'info', GREEN: 'success' }, + uButton: { WHITE: 'default', BLUE: 'primary', YELLOW: 'warning', RED: 'error', GREY: 'info', GREEN: 'success' }, + uNoticeBar: { YELLOW: 'warning', BLUE: 'primary', RED: 'error', GREY: 'info', GREEN: 'success', TRANS: 'none' }, + uTag: { BLUE: 'primary', RED: 'error', YELLOW: 'warning', GREY: 'info', GREEN: 'success' }, + uToast: { BLACK: 'default', BLUE: 'primary', YELLOW: 'warning', RED: 'error', GREY: 'info', GREEN: 'success' }, + uTopTips: { BLUE: 'primary', RED: 'error', YELLOW: 'warning', GREY: 'info', GREEN: 'success' }, + + uniBadge: { GREY: 'default', YELLOW: 'warning', BLUE: 'primary', GREEN: 'success', RED: 'error' }, + uniButton: { GREY: 'default', RED: 'warn', RGB: 'primary' }, + uniPopupDialog: { GREEN: 'success', YELLOW: 'warn', RED: 'error', GREY: 'info' }, + uniPopupMessage: { GREEN: 'success', YELLOW: 'warn', RED: 'error', GREY: 'info' }, + uniTag: { GREY: 'default', YELLOW: 'warning', BLUE: 'primary', GREEN: 'success', RED: 'error', PURPLE: 'royal' }, + }, thisPage () { return this.__page__ @@ -29,7 +44,7 @@ export default { console.info('%c ' + JSON.stringify({ time: new Date().toJSON(), page: pageName }), 'color:green;background:lightgrey', ...args) }, ccwarn (...args) { - const pageName = this.thisPage().route || 'VueApp' + const pageName = this.thisPage()?.route || 'VueApp' console.warn('%c ' + JSON.stringify({ time: new Date().toJSON(), page: pageName }), 'color:orange;background:lightgrey', ...args) }, ccerror (...args) {