From d1448cb0ef10f358bb7bddb4e1ec268515e0b787 Mon Sep 17 00:00:00 2001 From: gaoluyang <2820782392@qq.com> Date: 星期二, 15 七月 2025 11:46:57 +0800 Subject: [PATCH] 项目初始化 --- uni_modules/uview-ui/index.js | 79 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 79 insertions(+), 0 deletions(-) diff --git a/uni_modules/uview-ui/index.js b/uni_modules/uview-ui/index.js new file mode 100644 index 0000000..651c090 --- /dev/null +++ b/uni_modules/uview-ui/index.js @@ -0,0 +1,79 @@ +// 鐪嬪埌姝ゆ姤閿欙紝鏄洜涓烘病鏈夐厤缃畍ue.config.js鐨勩�恡ranspileDependencies銆戯紝璇﹁锛歨ttps://www.uviewui.com/components/npmSetting.html#_5-cli妯″紡棰濆閰嶇疆 +const pleaseSetTranspileDependencies = {}, babelTest = pleaseSetTranspileDependencies?.test + + + +// 寮曞叆鍏ㄥ眬mixin +import mixin from './libs/mixin/mixin.js' +// 灏忕▼搴忕壒鏈夌殑mixin +import mpMixin from './libs/mixin/mpMixin.js' +// 鍏ㄥ眬鎸傝浇寮曞叆http鐩稿叧璇锋眰鎷︽埅鎻掍欢 +import Request from './libs/luch-request' + +// 璺敱灏佽 +import route from './libs/util/route.js' +// 棰滆壊娓愬彉鐩稿叧,colorGradient-棰滆壊娓愬彉,hexToRgb-鍗佸叚杩涘埗棰滆壊杞瑀gb棰滆壊,rgbToHex-rgb杞崄鍏繘鍒� +import colorGradient from './libs/function/colorGradient.js' + +// 瑙勫垯妫�楠� +import test from './libs/function/test.js' +// 闃叉姈鏂规硶 +import debounce from './libs/function/debounce.js' +// 鑺傛祦鏂规硶 +import throttle from './libs/function/throttle.js' +// 鍏叡鏂囦欢鍐欏叆鐨勬柟娉� +import index from './libs/function/index.js' + +// 閰嶇疆淇℃伅 +import config from './libs/config/config.js' +// props閰嶇疆淇℃伅 +import props from './libs/config/props.js' +// 鍚勪釜闇�瑕乫ixed鐨勫湴鏂圭殑z-index閰嶇疆鏂囦欢 +import zIndex from './libs/config/zIndex.js' +// 鍏充簬棰滆壊鐨勯厤缃紝鐗规畩鍦烘櫙浣跨敤 +import color from './libs/config/color.js' +// 骞冲彴 +import platform from './libs/function/platform' + +const $u = { + route, + date: index.timeFormat, // 鍙﹀悕date + colorGradient: colorGradient.colorGradient, + hexToRgb: colorGradient.hexToRgb, + rgbToHex: colorGradient.rgbToHex, + colorToRgba: colorGradient.colorToRgba, + test, + type: ['primary', 'success', 'error', 'warning', 'info'], + http: new Request(), + config, // uView閰嶇疆淇℃伅鐩稿叧锛屾瘮濡傜増鏈彿 + zIndex, + debounce, + throttle, + mixin, + mpMixin, + props, + ...index, + color, + platform +} + +// $u鎸傝浇鍒皍ni瀵硅薄涓� +uni.$u = $u + +const install = (Vue) => { + // 鏃堕棿鏍煎紡鍖栵紝鍚屾椂涓や釜鍚嶇О锛宒ate鍜宼imeFormat + Vue.filter('timeFormat', (timestamp, format) => uni.$u.timeFormat(timestamp, format)) + Vue.filter('date', (timestamp, format) => uni.$u.timeFormat(timestamp, format)) + // 灏嗗涔呬互鍓嶇殑鏂规硶锛屾敞鍏ュ埌鍏ㄥ眬杩囨护鍣� + Vue.filter('timeFrom', (timestamp, format) => uni.$u.timeFrom(timestamp, format)) + // 鍚屾椂鎸傝浇鍒皍ni鍜孷ue.prototype涓� + // #ifndef APP-NVUE + // 鍙湁vue锛屾寕杞藉埌Vue.prototype鎵嶆湁鎰忎箟锛屽洜涓簄vue涓叏灞�Vue.prototype鍜孷ue.mixin鏄棤鏁堢殑 + Vue.prototype.$u = $u + Vue.mixin(mixin) + // #endif +} + +export default { + install +} -- Gitblit v1.9.3