123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- import { mixin } from './libs/mixin/mixin.js'
- import { mpMixin } from './libs/mixin/mpMixin.js'
- import Request from './libs/luch-request'
- import route from './libs/util/route.js'
- 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'
- import props from './libs/config/props.js'
- import zIndex from './libs/config/zIndex.js'
- import color from './libs/config/color.js'
- import platform from './libs/function/platform'
- const http = new Request()
- let themeType = ['primary', 'success', 'error', 'warning', 'info'];
- export { route, http, debounce, throttle, platform, themeType, mixin, mpMixin, props, color, test, zIndex }
- export * from './libs/function/index.js'
- export * from './libs/function/colorGradient.js'
- export function setConfig(configs) {
- index.shallowMerge(config, configs.config || {})
- index.shallowMerge(props, configs.props || {})
- index.shallowMerge(color, configs.color || {})
- index.shallowMerge(zIndex, configs.zIndex || {})
- }
- index.setConfig = setConfig
- const $u = {
- route,
- date: index.timeFormat,
- colorGradient: colorGradient.colorGradient,
- hexToRgb: colorGradient.hexToRgb,
- rgbToHex: colorGradient.rgbToHex,
- colorToRgba: colorGradient.colorToRgba,
- test,
- type: themeType,
- http,
- config,
- zIndex,
- debounce,
- throttle,
- mixin,
- mpMixin,
- props,
- ...index,
- color,
- platform
- }
- export const mount$u = function() {
- uni.$u = $u
- }
- const importFn = import.meta.glob('./components/u-*/u-*.vue', { eager: true })
- let components = [];
- for (const key in importFn) {
- let component = importFn[key].default;
- if (component.name && component.name.indexOf('u--') !== 0) {
- component.install = function (Vue) {
- Vue.component(name, component);
- };
-
-
- components.push(component);
- }
- }
- function toCamelCase(str) {
- return str.replace(/-([a-z])/g, function(match, group1) {
- return group1.toUpperCase();
- }).replace(/^[a-z]/, function(match) {
- return match.toUpperCase();
- });
- }
- const install = (Vue) => {
-
- components.forEach(function(component) {
- const name = component.name.replace(/u-([a-zA-Z0-9-_]+)/g, 'up-$1');
- Vue.component(name, component);
- });
-
-
-
- uni.$u = $u
-
-
- Vue.config.globalProperties.$u = $u
- Vue.mixin(mixin)
-
- }
- export default {
- install
- }
|