uni-h5.esm.js 83.2 KB
Newer Older
fxy060608's avatar
fxy060608 已提交
1 2 3 4 5 6
import {isFunction, extend, isPlainObject, isPromise, isArray, hasOwn} from "@vue/shared";
import {injectHook, openBlock, createBlock, createVNode, Fragment, renderList, toDisplayString, createCommentVNode, createTextVNode, Transition, withCtx, withModifiers, withDirectives, vShow, resolveComponent, KeepAlive, resolveDynamicComponent, mergeProps, renderSlot} from "vue";
import {isCustomElement, TABBAR_HEIGHT, COMPONENT_NAME_PREFIX, NAVBAR_HEIGHT} from "@dcloudio/uni-shared";
import {passiveOptions, Input} from "@dcloudio/uni-components";
export * from "@dcloudio/uni-components";
import {createWebHistory, createWebHashHistory, createRouter} from "vue-router";
fxy060608's avatar
fxy060608 已提交
7
function applyOptions(options, instance2, publicThis) {
fxy060608's avatar
fxy060608 已提交
8 9 10
  Object.keys(options).forEach((name) => {
    if (name.indexOf("on") === 0) {
      const hook = options[name];
fxy060608's avatar
fxy060608 已提交
11
      if (isFunction(hook)) {
fxy060608's avatar
fxy060608 已提交
12
        injectHook(name, hook.bind(publicThis), instance2);
fxy060608's avatar
fxy060608 已提交
13 14
      }
    }
fxy060608's avatar
fxy060608 已提交
15
  });
fxy060608's avatar
fxy060608 已提交
16 17
}
function set(target, key, val) {
fxy060608's avatar
fxy060608 已提交
18
  return target[key] = val;
fxy060608's avatar
fxy060608 已提交
19 20
}
function hasHook(name) {
fxy060608's avatar
fxy060608 已提交
21
  const hooks = this.$[name];
fxy060608's avatar
fxy060608 已提交
22
  if (hooks && hooks.length) {
fxy060608's avatar
fxy060608 已提交
23
    return true;
fxy060608's avatar
fxy060608 已提交
24
  }
fxy060608's avatar
fxy060608 已提交
25
  return false;
fxy060608's avatar
fxy060608 已提交
26 27
}
function callHook(name, args) {
fxy060608's avatar
fxy060608 已提交
28 29
  const hooks = this.$[name];
  let ret;
fxy060608's avatar
fxy060608 已提交
30 31
  if (hooks) {
    for (let i = 0; i < hooks.length; i++) {
fxy060608's avatar
fxy060608 已提交
32
      ret = hooks[i](args);
fxy060608's avatar
fxy060608 已提交
33 34
    }
  }
fxy060608's avatar
fxy060608 已提交
35
  return ret;
fxy060608's avatar
fxy060608 已提交
36 37 38
}
function errorHandler(err, instance2, info) {
  if (!instance2) {
fxy060608's avatar
fxy060608 已提交
39
    throw err;
fxy060608's avatar
fxy060608 已提交
40
  }
fxy060608's avatar
fxy060608 已提交
41
  const appInstance = instance2.$.appContext.$appInstance;
fxy060608's avatar
fxy060608 已提交
42
  if (!appInstance) {
fxy060608's avatar
fxy060608 已提交
43
    throw err;
fxy060608's avatar
fxy060608 已提交
44
  }
fxy060608's avatar
fxy060608 已提交
45
  appInstance.$callHook("onError", err, info);
fxy060608's avatar
fxy060608 已提交
46 47
}
function initApp(app) {
fxy060608's avatar
fxy060608 已提交
48
  const appConfig2 = app._context.config;
fxy060608's avatar
fxy060608 已提交
49
  if (isFunction(app._component.onError)) {
fxy060608's avatar
fxy060608 已提交
50
    appConfig2.errorHandler = errorHandler;
fxy060608's avatar
fxy060608 已提交
51
  }
fxy060608's avatar
fxy060608 已提交
52 53 54 55
  appConfig2.isCustomElement = isCustomElement;
  const globalProperties = appConfig2.globalProperties;
  globalProperties.$hasHook = hasHook;
  globalProperties.$callHook = callHook;
fxy060608's avatar
fxy060608 已提交
56
  {
fxy060608's avatar
fxy060608 已提交
57 58
    globalProperties.$set = set;
    globalProperties.$applyOptions = applyOptions;
fxy060608's avatar
fxy060608 已提交
59 60 61
  }
}
function initBridge(namespace) {
fxy060608's avatar
fxy060608 已提交
62
  const {on, off, emit} = {
fxy060608's avatar
fxy060608 已提交
63
    on(event, callback) {
fxy060608's avatar
fxy060608 已提交
64
      console.log(event, callback);
fxy060608's avatar
fxy060608 已提交
65 66
    },
    off(event, callback) {
fxy060608's avatar
fxy060608 已提交
67
      console.log(event, callback);
fxy060608's avatar
fxy060608 已提交
68 69
    },
    emit(event, ...args) {
fxy060608's avatar
fxy060608 已提交
70
      console.log(event, args);
fxy060608's avatar
fxy060608 已提交
71
    }
fxy060608's avatar
fxy060608 已提交
72
  };
fxy060608's avatar
fxy060608 已提交
73 74 75 76 77
  return {
    on,
    off,
    emit,
    subscribe(event, callback) {
fxy060608's avatar
fxy060608 已提交
78
      return on(`${namespace}.${event}`, callback);
fxy060608's avatar
fxy060608 已提交
79 80
    },
    unsubscribe(event, callback) {
fxy060608's avatar
fxy060608 已提交
81
      return off(`${namespace}.${event}`, callback);
fxy060608's avatar
fxy060608 已提交
82 83
    },
    subscribeHandler(event, args, pageId) {
fxy060608's avatar
fxy060608 已提交
84 85
      if (process.env.NODE_ENV !== "production") {
        console.log(`[${namespace}][subscribeHandler][${Date.now()}]:${event}, ${JSON.stringify(args)}, ${pageId}`);
fxy060608's avatar
fxy060608 已提交
86
      }
fxy060608's avatar
fxy060608 已提交
87
      return emit(`${namespace}.${event}`, args, pageId);
fxy060608's avatar
fxy060608 已提交
88
    }
fxy060608's avatar
fxy060608 已提交
89
  };
fxy060608's avatar
fxy060608 已提交
90
}
fxy060608's avatar
fxy060608 已提交
91 92 93 94
const ViewJSBridge = initBridge("view");
const LONGPRESS_TIMEOUT = 350;
const LONGPRESS_THRESHOLD = 10;
let longPressTimer = 0;
fxy060608's avatar
fxy060608 已提交
95 96
function clearLongPressTimer() {
  if (longPressTimer) {
fxy060608's avatar
fxy060608 已提交
97 98
    clearTimeout(longPressTimer);
    longPressTimer = 0;
fxy060608's avatar
fxy060608 已提交
99 100
  }
}
fxy060608's avatar
fxy060608 已提交
101 102
let startPageX = 0;
let startPageY = 0;
fxy060608's avatar
fxy060608 已提交
103
function touchstart(evt) {
fxy060608's avatar
fxy060608 已提交
104
  clearLongPressTimer();
fxy060608's avatar
fxy060608 已提交
105
  if (evt.touches.length !== 1) {
fxy060608's avatar
fxy060608 已提交
106
    return;
fxy060608's avatar
fxy060608 已提交
107
  }
fxy060608's avatar
fxy060608 已提交
108 109 110
  const {pageX, pageY} = evt.touches[0];
  startPageX = pageX;
  startPageY = pageY;
fxy060608's avatar
fxy060608 已提交
111
  longPressTimer = setTimeout(function() {
fxy060608's avatar
fxy060608 已提交
112
    const customEvent = new CustomEvent("longpress", {
fxy060608's avatar
fxy060608 已提交
113 114 115 116
      bubbles: true,
      cancelable: true,
      target: evt.target,
      currentTarget: evt.currentTarget
fxy060608's avatar
fxy060608 已提交
117 118 119 120 121
    });
    customEvent.touches = evt.touches;
    customEvent.changedTouches = evt.changedTouches;
    evt.target.dispatchEvent(customEvent);
  }, LONGPRESS_TIMEOUT);
fxy060608's avatar
fxy060608 已提交
122 123 124
}
function touchmove(evt) {
  if (!longPressTimer) {
fxy060608's avatar
fxy060608 已提交
125
    return;
fxy060608's avatar
fxy060608 已提交
126 127
  }
  if (evt.touches.length !== 1) {
fxy060608's avatar
fxy060608 已提交
128
    return clearLongPressTimer();
fxy060608's avatar
fxy060608 已提交
129
  }
fxy060608's avatar
fxy060608 已提交
130 131 132
  const {pageX, pageY} = evt.touches[0];
  if (Math.abs(pageX - startPageX) > LONGPRESS_THRESHOLD || Math.abs(pageY - startPageY) > LONGPRESS_THRESHOLD) {
    return clearLongPressTimer();
fxy060608's avatar
fxy060608 已提交
133 134 135
  }
}
function initLongPress() {
fxy060608's avatar
fxy060608 已提交
136 137 138 139 140 141 142 143 144
  window.addEventListener("touchstart", touchstart, passiveOptions);
  window.addEventListener("touchmove", touchmove, passiveOptions);
  window.addEventListener("touchend", clearLongPressTimer, passiveOptions);
  window.addEventListener("touchcancel", clearLongPressTimer, passiveOptions);
}
var attrs = ["top", "left", "right", "bottom"];
var inited;
var elementComputedStyle = {};
var support;
fxy060608's avatar
fxy060608 已提交
145
function getSupport() {
fxy060608's avatar
fxy060608 已提交
146 147 148 149 150 151
  if (!("CSS" in window) || typeof CSS.supports != "function") {
    support = "";
  } else if (CSS.supports("top: env(safe-area-inset-top)")) {
    support = "env";
  } else if (CSS.supports("top: constant(safe-area-inset-top)")) {
    support = "constant";
fxy060608's avatar
fxy060608 已提交
152
  } else {
fxy060608's avatar
fxy060608 已提交
153
    support = "";
fxy060608's avatar
fxy060608 已提交
154
  }
fxy060608's avatar
fxy060608 已提交
155
  return support;
fxy060608's avatar
fxy060608 已提交
156 157
}
function init() {
fxy060608's avatar
fxy060608 已提交
158
  support = typeof support === "string" ? support : getSupport();
fxy060608's avatar
fxy060608 已提交
159 160
  if (!support) {
    attrs.forEach(function(attr) {
fxy060608's avatar
fxy060608 已提交
161 162 163
      elementComputedStyle[attr] = 0;
    });
    return;
fxy060608's avatar
fxy060608 已提交
164 165
  }
  function setStyle(el, style) {
fxy060608's avatar
fxy060608 已提交
166
    var elStyle = el.style;
fxy060608's avatar
fxy060608 已提交
167
    Object.keys(style).forEach(function(key) {
fxy060608's avatar
fxy060608 已提交
168 169 170
      var val = style[key];
      elStyle[key] = val;
    });
fxy060608's avatar
fxy060608 已提交
171
  }
fxy060608's avatar
fxy060608 已提交
172
  var cbs = [];
fxy060608's avatar
fxy060608 已提交
173 174
  function parentReady(callback) {
    if (callback) {
fxy060608's avatar
fxy060608 已提交
175
      cbs.push(callback);
fxy060608's avatar
fxy060608 已提交
176 177
    } else {
      cbs.forEach(function(cb) {
fxy060608's avatar
fxy060608 已提交
178 179
        cb();
      });
fxy060608's avatar
fxy060608 已提交
180 181
    }
  }
fxy060608's avatar
fxy060608 已提交
182
  var passiveEvents = false;
fxy060608's avatar
fxy060608 已提交
183
  try {
fxy060608's avatar
fxy060608 已提交
184
    var opts = Object.defineProperty({}, "passive", {
fxy060608's avatar
fxy060608 已提交
185
      get: function() {
fxy060608's avatar
fxy060608 已提交
186
        passiveEvents = {passive: true};
fxy060608's avatar
fxy060608 已提交
187
      }
fxy060608's avatar
fxy060608 已提交
188 189 190 191
    });
    window.addEventListener("test", null, opts);
  } catch (e) {
  }
fxy060608's avatar
fxy060608 已提交
192
  function addChild(parent, attr) {
fxy060608's avatar
fxy060608 已提交
193 194 195 196 197 198
    var a1 = document.createElement("div");
    var a2 = document.createElement("div");
    var a1Children = document.createElement("div");
    var a2Children = document.createElement("div");
    var W = 100;
    var MAX = 1e4;
fxy060608's avatar
fxy060608 已提交
199
    var aStyle = {
fxy060608's avatar
fxy060608 已提交
200 201 202 203 204 205 206 207 208
      position: "absolute",
      width: W + "px",
      height: "200px",
      boxSizing: "border-box",
      overflow: "hidden",
      paddingBottom: support + "(safe-area-inset-" + attr + ")"
    };
    setStyle(a1, aStyle);
    setStyle(a2, aStyle);
fxy060608's avatar
fxy060608 已提交
209
    setStyle(a1Children, {
fxy060608's avatar
fxy060608 已提交
210 211 212 213 214
      transition: "0s",
      animation: "none",
      width: "400px",
      height: "400px"
    });
fxy060608's avatar
fxy060608 已提交
215
    setStyle(a2Children, {
fxy060608's avatar
fxy060608 已提交
216 217 218 219 220 221 222 223 224
      transition: "0s",
      animation: "none",
      width: "250%",
      height: "250%"
    });
    a1.appendChild(a1Children);
    a2.appendChild(a2Children);
    parent.appendChild(a1);
    parent.appendChild(a2);
fxy060608's avatar
fxy060608 已提交
225
    parentReady(function() {
fxy060608's avatar
fxy060608 已提交
226 227 228
      a1.scrollTop = a2.scrollTop = MAX;
      var a1LastScrollTop = a1.scrollTop;
      var a2LastScrollTop = a2.scrollTop;
fxy060608's avatar
fxy060608 已提交
229
      function onScroll() {
fxy060608's avatar
fxy060608 已提交
230 231
        if (this.scrollTop === (this === a1 ? a1LastScrollTop : a2LastScrollTop)) {
          return;
fxy060608's avatar
fxy060608 已提交
232
        }
fxy060608's avatar
fxy060608 已提交
233 234 235 236 237 238 239 240 241
        a1.scrollTop = a2.scrollTop = MAX;
        a1LastScrollTop = a1.scrollTop;
        a2LastScrollTop = a2.scrollTop;
        attrChange(attr);
      }
      a1.addEventListener("scroll", onScroll, passiveEvents);
      a2.addEventListener("scroll", onScroll, passiveEvents);
    });
    var computedStyle = getComputedStyle(a1);
fxy060608's avatar
fxy060608 已提交
242 243 244
    Object.defineProperty(elementComputedStyle, attr, {
      configurable: true,
      get: function() {
fxy060608's avatar
fxy060608 已提交
245
        return parseFloat(computedStyle.paddingBottom);
fxy060608's avatar
fxy060608 已提交
246
      }
fxy060608's avatar
fxy060608 已提交
247
    });
fxy060608's avatar
fxy060608 已提交
248
  }
fxy060608's avatar
fxy060608 已提交
249
  var parentDiv = document.createElement("div");
fxy060608's avatar
fxy060608 已提交
250
  setStyle(parentDiv, {
fxy060608's avatar
fxy060608 已提交
251 252 253 254 255 256 257 258 259
    position: "absolute",
    left: "0",
    top: "0",
    width: "0",
    height: "0",
    zIndex: "-1",
    overflow: "hidden",
    visibility: "hidden"
  });
fxy060608's avatar
fxy060608 已提交
260
  attrs.forEach(function(key) {
fxy060608's avatar
fxy060608 已提交
261 262 263 264 265
    addChild(parentDiv, key);
  });
  document.body.appendChild(parentDiv);
  parentReady();
  inited = true;
fxy060608's avatar
fxy060608 已提交
266 267 268
}
function getAttr(attr) {
  if (!inited) {
fxy060608's avatar
fxy060608 已提交
269
    init();
fxy060608's avatar
fxy060608 已提交
270
  }
fxy060608's avatar
fxy060608 已提交
271
  return elementComputedStyle[attr];
fxy060608's avatar
fxy060608 已提交
272
}
fxy060608's avatar
fxy060608 已提交
273
var changeAttrs = [];
fxy060608's avatar
fxy060608 已提交
274 275 276
function attrChange(attr) {
  if (!changeAttrs.length) {
    setTimeout(function() {
fxy060608's avatar
fxy060608 已提交
277
      var style = {};
fxy060608's avatar
fxy060608 已提交
278
      changeAttrs.forEach(function(attr2) {
fxy060608's avatar
fxy060608 已提交
279 280 281
        style[attr2] = elementComputedStyle[attr2];
      });
      changeAttrs.length = 0;
fxy060608's avatar
fxy060608 已提交
282
      callbacks.forEach(function(callback) {
fxy060608's avatar
fxy060608 已提交
283 284 285
        callback(style);
      });
    }, 0);
fxy060608's avatar
fxy060608 已提交
286
  }
fxy060608's avatar
fxy060608 已提交
287
  changeAttrs.push(attr);
fxy060608's avatar
fxy060608 已提交
288
}
fxy060608's avatar
fxy060608 已提交
289
var callbacks = [];
fxy060608's avatar
fxy060608 已提交
290 291
function onChange(callback) {
  if (!getSupport()) {
fxy060608's avatar
fxy060608 已提交
292
    return;
fxy060608's avatar
fxy060608 已提交
293 294
  }
  if (!inited) {
fxy060608's avatar
fxy060608 已提交
295
    init();
fxy060608's avatar
fxy060608 已提交
296
  }
fxy060608's avatar
fxy060608 已提交
297 298
  if (typeof callback === "function") {
    callbacks.push(callback);
fxy060608's avatar
fxy060608 已提交
299 300 301
  }
}
function offChange(callback) {
fxy060608's avatar
fxy060608 已提交
302
  var index2 = callbacks.indexOf(callback);
fxy060608's avatar
fxy060608 已提交
303
  if (index2 >= 0) {
fxy060608's avatar
fxy060608 已提交
304
    callbacks.splice(index2, 1);
fxy060608's avatar
fxy060608 已提交
305 306 307 308
  }
}
var safeAreaInsets = {
  get support() {
fxy060608's avatar
fxy060608 已提交
309
    return (typeof support === "string" ? support : getSupport()).length != 0;
fxy060608's avatar
fxy060608 已提交
310 311
  },
  get top() {
fxy060608's avatar
fxy060608 已提交
312
    return getAttr("top");
fxy060608's avatar
fxy060608 已提交
313 314
  },
  get left() {
fxy060608's avatar
fxy060608 已提交
315
    return getAttr("left");
fxy060608's avatar
fxy060608 已提交
316 317
  },
  get right() {
fxy060608's avatar
fxy060608 已提交
318
    return getAttr("right");
fxy060608's avatar
fxy060608 已提交
319 320
  },
  get bottom() {
fxy060608's avatar
fxy060608 已提交
321
    return getAttr("bottom");
fxy060608's avatar
fxy060608 已提交
322 323 324
  },
  onChange,
  offChange
fxy060608's avatar
fxy060608 已提交
325 326
};
var out = safeAreaInsets;
fxy060608's avatar
fxy060608 已提交
327
function getWindowOffset() {
fxy060608's avatar
fxy060608 已提交
328 329 330 331 332 333
  if (uni.canIUse("css.var")) {
    const style = document.documentElement.style;
    const top = parseInt(style.getPropertyValue("--window-top"));
    const bottom = parseInt(style.getPropertyValue("--window-bottom"));
    const left = parseInt(style.getPropertyValue("--window-left"));
    const right = parseInt(style.getPropertyValue("--window-right"));
fxy060608's avatar
fxy060608 已提交
334 335 336 337 338
    return {
      top: top ? top + out.top : 0,
      bottom: bottom ? bottom + out.bottom : 0,
      left: left ? left + out.left : 0,
      right: right ? right + out.right : 0
fxy060608's avatar
fxy060608 已提交
339
    };
fxy060608's avatar
fxy060608 已提交
340 341 342 343 344 345
  }
  return {
    top: 0,
    bottom: 0,
    left: 0,
    right: 0
fxy060608's avatar
fxy060608 已提交
346
  };
fxy060608's avatar
fxy060608 已提交
347 348
}
function findUniTarget($event, $el) {
fxy060608's avatar
fxy060608 已提交
349
  let target = $event.target;
fxy060608's avatar
fxy060608 已提交
350
  for (; target && target !== $el; target = target.parentNode) {
fxy060608's avatar
fxy060608 已提交
351 352
    if (target.tagName && target.tagName.indexOf("UNI-") === 0) {
      break;
fxy060608's avatar
fxy060608 已提交
353 354
    }
  }
fxy060608's avatar
fxy060608 已提交
355
  return target;
fxy060608's avatar
fxy060608 已提交
356 357
}
function normalizeDataset(dataset = {}) {
fxy060608's avatar
fxy060608 已提交
358 359
  const result = JSON.parse(JSON.stringify(dataset));
  return result;
fxy060608's avatar
fxy060608 已提交
360 361 362
}
function normalizeEvent(name, $event, detail = {}, target, currentTarget) {
  if ($event._processed) {
fxy060608's avatar
fxy060608 已提交
363 364
    $event.type = detail.type || name;
    return $event;
fxy060608's avatar
fxy060608 已提交
365 366
  }
  if (isClickEvent($event, name)) {
fxy060608's avatar
fxy060608 已提交
367
    const {top} = getWindowOffset();
fxy060608's avatar
fxy060608 已提交
368 369 370
    detail = {
      x: $event.x,
      y: $event.y - top
fxy060608's avatar
fxy060608 已提交
371 372
    };
    normalizeClickEvent($event);
fxy060608's avatar
fxy060608 已提交
373 374 375 376 377 378 379 380 381 382
  }
  const ret = {
    _processed: true,
    type: detail.type || name,
    timeStamp: $event.timeStamp || 0,
    detail,
    target: normalizeTarget(target, detail),
    currentTarget: normalizeTarget(currentTarget),
    touches: normalizeTouchList($event.touches),
    changedTouches: normalizeTouchList($event.changedTouches),
fxy060608's avatar
fxy060608 已提交
383 384 385 386 387 388
    preventDefault() {
    },
    stopPropagation() {
    }
  };
  return ret;
fxy060608's avatar
fxy060608 已提交
389 390 391 392 393 394 395 396 397 398 399
}
function normalizeClickEvent($event) {
  $event.touches = $event.changedTouches = [
    {
      force: 1,
      identifier: 0,
      clientX: $event.clientX,
      clientY: $event.clientY,
      pageX: $event.pageX,
      pageY: $event.pageY
    }
fxy060608's avatar
fxy060608 已提交
400
  ];
fxy060608's avatar
fxy060608 已提交
401 402
}
function isClickEvent(val, name) {
fxy060608's avatar
fxy060608 已提交
403
  return name === "click";
fxy060608's avatar
fxy060608 已提交
404 405 406
}
function normalizeTarget(target, detail) {
  if (!target) {
fxy060608's avatar
fxy060608 已提交
407
    target = {};
fxy060608's avatar
fxy060608 已提交
408 409 410 411 412 413
  }
  const res = {
    id: target.id,
    offsetLeft: target.offsetLeft,
    offsetTop: target.offsetTop,
    dataset: normalizeDataset(target.dataset)
fxy060608's avatar
fxy060608 已提交
414
  };
fxy060608's avatar
fxy060608 已提交
415
  if (detail) {
fxy060608's avatar
fxy060608 已提交
416
    extend(res, detail);
fxy060608's avatar
fxy060608 已提交
417
  }
fxy060608's avatar
fxy060608 已提交
418
  return res;
fxy060608's avatar
fxy060608 已提交
419 420 421
}
function normalizeTouchList(touches) {
  if (touches && touches instanceof TouchList) {
fxy060608's avatar
fxy060608 已提交
422 423
    const res = [];
    const {top} = getWindowOffset();
fxy060608's avatar
fxy060608 已提交
424
    for (let i = 0; i < touches.length; i++) {
fxy060608's avatar
fxy060608 已提交
425
      const touch = touches[i];
fxy060608's avatar
fxy060608 已提交
426 427 428 429 430 431 432
      res.push({
        identifier: touch.identifier,
        pageX: touch.pageX,
        pageY: touch.pageY - top,
        clientX: touch.clientX,
        clientY: touch.clientY - top,
        force: touch.force || 0
fxy060608's avatar
fxy060608 已提交
433
      });
fxy060608's avatar
fxy060608 已提交
434
    }
fxy060608's avatar
fxy060608 已提交
435
    return res;
fxy060608's avatar
fxy060608 已提交
436
  }
fxy060608's avatar
fxy060608 已提交
437
  return [];
fxy060608's avatar
fxy060608 已提交
438 439
}
function $trigger(name, $event, detail) {
fxy060608's avatar
fxy060608 已提交
440 441
  const target = this.$el;
  this.$emit(name, normalizeEvent(name, $event, detail, target, target));
fxy060608's avatar
fxy060608 已提交
442 443 444
}
function $handleEvent($event) {
  if ($event instanceof Event) {
fxy060608's avatar
fxy060608 已提交
445 446
    const target = findUniTarget($event, this.$el);
    return normalizeEvent($event.type, $event, {}, target || $event.target, $event.currentTarget);
fxy060608's avatar
fxy060608 已提交
447
  }
fxy060608's avatar
fxy060608 已提交
448
  return $event;
fxy060608's avatar
fxy060608 已提交
449 450
}
function $getRealPath(v) {
fxy060608's avatar
fxy060608 已提交
451
  return v;
fxy060608's avatar
fxy060608 已提交
452 453 454 455 456 457
}
var instance = /* @__PURE__ */ Object.freeze({
  __proto__: null,
  $trigger,
  $handleEvent,
  $getRealPath
fxy060608's avatar
fxy060608 已提交
458 459 460
});
const CLASS_RE = /^\s+|\s+$/g;
const WXS_CLASS_RE = /\s+/;
fxy060608's avatar
fxy060608 已提交
461
function getWxsClsArr(clsArr, classList, isAdd) {
fxy060608's avatar
fxy060608 已提交
462
  const wxsClsArr = [];
fxy060608's avatar
fxy060608 已提交
463 464 465
  let checkClassList = function(cls) {
    if (isAdd) {
      checkClassList = function(cls2) {
fxy060608's avatar
fxy060608 已提交
466 467
        return !classList.contains(cls2);
      };
fxy060608's avatar
fxy060608 已提交
468 469
    } else {
      checkClassList = function(cls2) {
fxy060608's avatar
fxy060608 已提交
470 471
        return classList.contains(cls2);
      };
fxy060608's avatar
fxy060608 已提交
472
    }
fxy060608's avatar
fxy060608 已提交
473 474 475 476 477 478 479
    return checkClassList(cls);
  };
  clsArr.forEach((cls) => {
    cls = cls.replace(CLASS_RE, "");
    checkClassList(cls) && wxsClsArr.push(cls);
  });
  return wxsClsArr;
fxy060608's avatar
fxy060608 已提交
480 481
}
function parseStyleText(cssText) {
fxy060608's avatar
fxy060608 已提交
482 483 484
  const res = {};
  const listDelimiter = /;(?![^(]*\))/g;
  const propertyDelimiter = /:(.+)/;
fxy060608's avatar
fxy060608 已提交
485 486
  cssText.split(listDelimiter).forEach(function(item) {
    if (item) {
fxy060608's avatar
fxy060608 已提交
487 488
      const tmp = item.split(propertyDelimiter);
      tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
fxy060608's avatar
fxy060608 已提交
489
    }
fxy060608's avatar
fxy060608 已提交
490 491
  });
  return res;
fxy060608's avatar
fxy060608 已提交
492 493 494
}
class ComponentDescriptor {
  constructor(vm) {
fxy060608's avatar
fxy060608 已提交
495 496
    this.$vm = vm;
    this.$el = vm.$el;
fxy060608's avatar
fxy060608 已提交
497 498 499
  }
  selectComponent(selector) {
    if (!this.$el || !selector) {
fxy060608's avatar
fxy060608 已提交
500
      return;
fxy060608's avatar
fxy060608 已提交
501
    }
fxy060608's avatar
fxy060608 已提交
502 503
    const el = this.$el.querySelector(selector);
    return el && el.__vue__ && createComponentDescriptor(el.__vue__, false);
fxy060608's avatar
fxy060608 已提交
504 505 506
  }
  selectAllComponents(selector) {
    if (!this.$el || !selector) {
fxy060608's avatar
fxy060608 已提交
507
      return [];
fxy060608's avatar
fxy060608 已提交
508
    }
fxy060608's avatar
fxy060608 已提交
509 510
    const descriptors = [];
    const els = this.$el.querySelectorAll(selector);
fxy060608's avatar
fxy060608 已提交
511
    for (let i = 0; i < els.length; i++) {
fxy060608's avatar
fxy060608 已提交
512 513
      const el = els[i];
      el.__vue__ && descriptors.push(createComponentDescriptor(el.__vue__, false));
fxy060608's avatar
fxy060608 已提交
514
    }
fxy060608's avatar
fxy060608 已提交
515
    return descriptors;
fxy060608's avatar
fxy060608 已提交
516 517 518
  }
  setStyle(style) {
    if (!this.$el || !style) {
fxy060608's avatar
fxy060608 已提交
519
      return this;
fxy060608's avatar
fxy060608 已提交
520
    }
fxy060608's avatar
fxy060608 已提交
521 522
    if (typeof style === "string") {
      style = parseStyleText(style);
fxy060608's avatar
fxy060608 已提交
523 524
    }
    if (isPlainObject(style)) {
fxy060608's avatar
fxy060608 已提交
525 526
      this.$el.__wxsStyle = style;
      this.$vm.$forceUpdate();
fxy060608's avatar
fxy060608 已提交
527
    }
fxy060608's avatar
fxy060608 已提交
528
    return this;
fxy060608's avatar
fxy060608 已提交
529 530 531
  }
  addClass(...clsArr) {
    if (!this.$el || !clsArr.length) {
fxy060608's avatar
fxy060608 已提交
532
      return this;
fxy060608's avatar
fxy060608 已提交
533
    }
fxy060608's avatar
fxy060608 已提交
534
    const wxsClsArr = getWxsClsArr(clsArr, this.$el.classList, true);
fxy060608's avatar
fxy060608 已提交
535
    if (wxsClsArr.length) {
fxy060608's avatar
fxy060608 已提交
536 537 538
      const wxsClass = this.$el.__wxsAddClass || "";
      this.$el.__wxsAddClass = wxsClass + (wxsClass ? " " : "") + wxsClsArr.join(" ");
      this.$vm.$forceUpdate();
fxy060608's avatar
fxy060608 已提交
539
    }
fxy060608's avatar
fxy060608 已提交
540
    return this;
fxy060608's avatar
fxy060608 已提交
541 542 543
  }
  removeClass(...clsArr) {
    if (!this.$el || !clsArr.length) {
fxy060608's avatar
fxy060608 已提交
544
      return this;
fxy060608's avatar
fxy060608 已提交
545
    }
fxy060608's avatar
fxy060608 已提交
546 547 548
    const classList = this.$el.classList;
    const addWxsClsArr = this.$el.__wxsAddClass ? this.$el.__wxsAddClass.split(WXS_CLASS_RE) : [];
    const wxsClsArr = getWxsClsArr(clsArr, classList, false);
fxy060608's avatar
fxy060608 已提交
549
    if (wxsClsArr.length) {
fxy060608's avatar
fxy060608 已提交
550 551 552
      const removeWxsClsArr = [];
      wxsClsArr.forEach((cls) => {
        const clsIndex = addWxsClsArr.findIndex((oldCls) => oldCls === cls);
fxy060608's avatar
fxy060608 已提交
553
        if (clsIndex !== -1) {
fxy060608's avatar
fxy060608 已提交
554
          addWxsClsArr.splice(clsIndex, 1);
fxy060608's avatar
fxy060608 已提交
555
        }
fxy060608's avatar
fxy060608 已提交
556 557 558 559 560
        removeWxsClsArr.push(cls);
      });
      this.$el.__wxsRemoveClass = removeWxsClsArr;
      this.$el.__wxsAddClass = addWxsClsArr.join(" ");
      this.$vm.$forceUpdate();
fxy060608's avatar
fxy060608 已提交
561
    }
fxy060608's avatar
fxy060608 已提交
562
    return this;
fxy060608's avatar
fxy060608 已提交
563 564
  }
  hasClass(cls) {
fxy060608's avatar
fxy060608 已提交
565
    return this.$el && this.$el.classList.contains(cls);
fxy060608's avatar
fxy060608 已提交
566 567 568
  }
  getComputedStyle() {
    if (this.$el) {
fxy060608's avatar
fxy060608 已提交
569
      return window.getComputedStyle(this.$el);
fxy060608's avatar
fxy060608 已提交
570
    }
fxy060608's avatar
fxy060608 已提交
571
    return {};
fxy060608's avatar
fxy060608 已提交
572 573
  }
  getDataset() {
fxy060608's avatar
fxy060608 已提交
574
    return this.$el && this.$el.dataset;
fxy060608's avatar
fxy060608 已提交
575 576
  }
  callMethod(funcName, args = {}) {
fxy060608's avatar
fxy060608 已提交
577
    const func = this.$vm[funcName];
fxy060608's avatar
fxy060608 已提交
578
    if (isFunction(func)) {
fxy060608's avatar
fxy060608 已提交
579
      func(JSON.parse(JSON.stringify(args)));
fxy060608's avatar
fxy060608 已提交
580
    } else if (this.$vm._$id) {
fxy060608's avatar
fxy060608 已提交
581
      UniViewJSBridge.publishHandler("onWxsInvokeCallMethod", {
fxy060608's avatar
fxy060608 已提交
582 583 584
        cid: this.$vm._$id,
        method: funcName,
        args
fxy060608's avatar
fxy060608 已提交
585
      });
fxy060608's avatar
fxy060608 已提交
586 587 588
    }
  }
  requestAnimationFrame(callback) {
fxy060608's avatar
fxy060608 已提交
589
    return window.requestAnimationFrame(callback), this;
fxy060608's avatar
fxy060608 已提交
590 591
  }
  getState() {
fxy060608's avatar
fxy060608 已提交
592
    return this.$el && (this.$el.__wxsState || (this.$el.__wxsState = {}));
fxy060608's avatar
fxy060608 已提交
593 594
  }
  triggerEvent(eventName, detail = {}) {
fxy060608's avatar
fxy060608 已提交
595
    return this.$vm.$emit(eventName, detail), this;
fxy060608's avatar
fxy060608 已提交
596 597 598
  }
}
function createComponentDescriptor(vm, isOwnerInstance = true) {
fxy060608's avatar
fxy060608 已提交
599 600
  if (isOwnerInstance && vm && vm.$options.name && vm.$options.name.indexOf("VUni") === 0) {
    vm = vm.$parent;
fxy060608's avatar
fxy060608 已提交
601 602 603
  }
  if (vm && vm.$el) {
    if (!vm.$el.__wxsComponentDescriptor) {
fxy060608's avatar
fxy060608 已提交
604
      vm.$el.__wxsComponentDescriptor = new ComponentDescriptor(vm);
fxy060608's avatar
fxy060608 已提交
605
    }
fxy060608's avatar
fxy060608 已提交
606
    return vm.$el.__wxsComponentDescriptor;
fxy060608's avatar
fxy060608 已提交
607 608 609
  }
}
function getComponentDescriptor(instance2, isOwnerInstance) {
fxy060608's avatar
fxy060608 已提交
610
  return createComponentDescriptor(instance2 || this, isOwnerInstance);
fxy060608's avatar
fxy060608 已提交
611 612 613
}
function handleWxsEvent($event) {
  if (!($event instanceof Event)) {
fxy060608's avatar
fxy060608 已提交
614
    return $event;
fxy060608's avatar
fxy060608 已提交
615
  }
fxy060608's avatar
fxy060608 已提交
616 617 618 619 620 621 622 623
  const currentTarget = $event.currentTarget;
  const instance2 = currentTarget && currentTarget.__vue__ && getComponentDescriptor.call(this, currentTarget.__vue__, false);
  const $origEvent = $event;
  $event = normalizeEvent($origEvent.type, $origEvent, {}, findUniTarget($origEvent, this.$el) || $origEvent.target, $origEvent.currentTarget);
  $event.instance = instance2;
  $event.preventDefault = function() {
    return $origEvent.preventDefault();
  };
fxy060608's avatar
fxy060608 已提交
624
  $event.stopPropagation = function() {
fxy060608's avatar
fxy060608 已提交
625 626
    return $origEvent.stopPropagation();
  };
fxy060608's avatar
fxy060608 已提交
627 628
}
function initAppConfig(appConfig) {
fxy060608's avatar
fxy060608 已提交
629 630
  const globalProperties = appConfig.globalProperties;
  extend(globalProperties, instance);
fxy060608's avatar
fxy060608 已提交
631
  if (__UNI_WXS_API__) {
fxy060608's avatar
fxy060608 已提交
632 633
    globalProperties.getComponentDescriptor = getComponentDescriptor;
    Object.defineProperty(globalProperties, "$ownerInstance", {
fxy060608's avatar
fxy060608 已提交
634
      get() {
fxy060608's avatar
fxy060608 已提交
635
        return this.$getComponentDescriptor(this);
fxy060608's avatar
fxy060608 已提交
636
      }
fxy060608's avatar
fxy060608 已提交
637 638
    });
    globalProperties.$handleWxsEvent = handleWxsEvent;
fxy060608's avatar
fxy060608 已提交
639 640 641
  }
}
function initView(app) {
fxy060608's avatar
fxy060608 已提交
642 643
  initLongPress();
  initAppConfig(app._context.config);
fxy060608's avatar
fxy060608 已提交
644
}
fxy060608's avatar
fxy060608 已提交
645
const ServiceJSBridge = initBridge("service");
fxy060608's avatar
fxy060608 已提交
646
function querySelector(vm, selector) {
fxy060608's avatar
fxy060608 已提交
647 648
  const el = vm.$el.querySelector(selector);
  return el && el.__vue__;
fxy060608's avatar
fxy060608 已提交
649 650
}
function querySelectorAll(vm, selector) {
fxy060608's avatar
fxy060608 已提交
651
  const nodeList = vm.$el.querySelectorAll(selector);
fxy060608's avatar
fxy060608 已提交
652
  if (nodeList) {
fxy060608's avatar
fxy060608 已提交
653
    return [...nodeList].map((node) => node.__vue__).filter(Boolean);
fxy060608's avatar
fxy060608 已提交
654
  }
fxy060608's avatar
fxy060608 已提交
655
  return [];
fxy060608's avatar
fxy060608 已提交
656 657
}
function createSelectorQuery() {
fxy060608's avatar
fxy060608 已提交
658
  return uni.createSelectorQuery().in(this);
fxy060608's avatar
fxy060608 已提交
659 660
}
function createIntersectionObserver(options) {
fxy060608's avatar
fxy060608 已提交
661
  return uni.createIntersectionObserver(this, options);
fxy060608's avatar
fxy060608 已提交
662 663
}
function selectComponent(selector) {
fxy060608's avatar
fxy060608 已提交
664
  return querySelector(this, selector);
fxy060608's avatar
fxy060608 已提交
665 666
}
function selectAllComponents(selector) {
fxy060608's avatar
fxy060608 已提交
667
  return querySelectorAll(this, selector);
fxy060608's avatar
fxy060608 已提交
668 669 670 671 672 673 674
}
var wxInstance = /* @__PURE__ */ Object.freeze({
  __proto__: null,
  createSelectorQuery,
  createIntersectionObserver,
  selectComponent,
  selectAllComponents
fxy060608's avatar
fxy060608 已提交
675
});
fxy060608's avatar
fxy060608 已提交
676
function initAppConfig$1(appConfig) {
fxy060608's avatar
fxy060608 已提交
677
  const globalProperties = appConfig.globalProperties;
fxy060608's avatar
fxy060608 已提交
678
  if (__UNI_WX_API__) {
fxy060608's avatar
fxy060608 已提交
679
    extend(globalProperties, wxInstance);
fxy060608's avatar
fxy060608 已提交
680 681 682
  }
}
function initService(app) {
fxy060608's avatar
fxy060608 已提交
683
  initAppConfig$1(app._context.config);
fxy060608's avatar
fxy060608 已提交
684 685
}
function initRouter(app) {
fxy060608's avatar
fxy060608 已提交
686 687 688 689 690 691 692 693
  const history = __UNI_ROUTER_MODE__ === "history" ? createWebHistory() : createWebHashHistory();
  app.use(createRouter({
    history,
    strict: !!__uniConfig.router.strict,
    routes: __uniRoutes,
    scrollBehavior(to, from, savedPosition) {
      if (savedPosition) {
        return savedPosition;
fxy060608's avatar
fxy060608 已提交
694
      }
fxy060608's avatar
fxy060608 已提交
695 696
    }
  }));
fxy060608's avatar
fxy060608 已提交
697 698
}
var script = {
fxy060608's avatar
fxy060608 已提交
699
  name: "TabBar",
fxy060608's avatar
fxy060608 已提交
700 701
  props: {
    position: {
fxy060608's avatar
fxy060608 已提交
702
      default: "bottom",
fxy060608's avatar
fxy060608 已提交
703
      validator(value) {
fxy060608's avatar
fxy060608 已提交
704
        return ["bottom", "top"].indexOf(value) !== -1;
fxy060608's avatar
fxy060608 已提交
705 706 707 708
      }
    },
    color: {
      type: String,
fxy060608's avatar
fxy060608 已提交
709
      default: "#999"
fxy060608's avatar
fxy060608 已提交
710 711 712
    },
    selectedColor: {
      type: String,
fxy060608's avatar
fxy060608 已提交
713
      default: "#007aff"
fxy060608's avatar
fxy060608 已提交
714 715 716
    },
    backgroundColor: {
      type: String,
fxy060608's avatar
fxy060608 已提交
717
      default: "#f7f7fa"
fxy060608's avatar
fxy060608 已提交
718 719
    },
    borderStyle: {
fxy060608's avatar
fxy060608 已提交
720
      default: "black",
fxy060608's avatar
fxy060608 已提交
721
      validator(value) {
fxy060608's avatar
fxy060608 已提交
722
        return ["black", "white"].indexOf(value) !== -1;
fxy060608's avatar
fxy060608 已提交
723 724 725 726 727
      }
    },
    list: {
      type: Array,
      default: function() {
fxy060608's avatar
fxy060608 已提交
728
        return [];
fxy060608's avatar
fxy060608 已提交
729 730 731 732 733
      }
    }
  },
  computed: {
    borderColor() {
fxy060608's avatar
fxy060608 已提交
734
      return this.borderStyle === "white" ? "rgba(255, 255, 255, 0.33)" : "rgba(0, 0, 0, 0.33)";
fxy060608's avatar
fxy060608 已提交
735 736 737 738 739
    }
  },
  watch: {
    $route(to, from) {
      if (to.meta.isTabBar) {
fxy060608's avatar
fxy060608 已提交
740
        this.__path__ = to.path;
fxy060608's avatar
fxy060608 已提交
741 742 743 744
      }
    }
  },
  beforeCreate() {
fxy060608's avatar
fxy060608 已提交
745
    this.__path__ = this.$route.path;
fxy060608's avatar
fxy060608 已提交
746 747 748
  },
  methods: {
    _getRealPath(filePath) {
fxy060608's avatar
fxy060608 已提交
749 750
      if (filePath.indexOf("/") !== 0) {
        filePath = "/" + filePath;
fxy060608's avatar
fxy060608 已提交
751
      }
fxy060608's avatar
fxy060608 已提交
752
      return this.$getRealPath(filePath);
fxy060608's avatar
fxy060608 已提交
753
    },
fxy060608's avatar
fxy060608 已提交
754 755 756 757 758
    _switchTab({
      text,
      pagePath
    }, index2) {
      let url = "/" + pagePath;
fxy060608's avatar
fxy060608 已提交
759
      if (url === __uniRoutes[0].alias) {
fxy060608's avatar
fxy060608 已提交
760
        url = "/";
fxy060608's avatar
fxy060608 已提交
761 762 763 764 765
      }
      const detail = {
        index: index2,
        text,
        pagePath
fxy060608's avatar
fxy060608 已提交
766
      };
fxy060608's avatar
fxy060608 已提交
767
      if (this.$route.path !== url) {
fxy060608's avatar
fxy060608 已提交
768
        this.__path__ = this.$route.path;
fxy060608's avatar
fxy060608 已提交
769
        uni.switchTab({
fxy060608's avatar
fxy060608 已提交
770
          from: "tabBar",
fxy060608's avatar
fxy060608 已提交
771 772
          url,
          detail
fxy060608's avatar
fxy060608 已提交
773
        });
fxy060608's avatar
fxy060608 已提交
774
      } else {
fxy060608's avatar
fxy060608 已提交
775
        UniServiceJSBridge.emit("onTabItemTap", detail);
fxy060608's avatar
fxy060608 已提交
776 777 778
      }
    }
  }
fxy060608's avatar
fxy060608 已提交
779 780 781
};
const _hoisted_1 = {class: "uni-tabbar__bd"};
const _hoisted_2 = /* @__PURE__ */ createVNode("div", {class: "uni-placeholder"}, null, -1);
fxy060608's avatar
fxy060608 已提交
782
function render(_ctx, _cache, $props, $setup, $data, $options) {
fxy060608's avatar
fxy060608 已提交
783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831
  return openBlock(), createBlock("uni-tabbar", null, [
    createVNode("div", {
      style: {backgroundColor: _ctx.backgroundColor},
      class: "uni-tabbar"
    }, [
      createVNode("div", {
        style: {backgroundColor: _ctx.borderColor},
        class: "uni-tabbar-border"
      }, null, 4),
      (openBlock(true), createBlock(Fragment, null, renderList(_ctx.list, (item, index2) => {
        return openBlock(), createBlock("div", {
          key: item.pagePath,
          class: "uni-tabbar__item",
          onClick: ($event) => _ctx._switchTab(item, index2)
        }, [
          createVNode("div", _hoisted_1, [
            item.iconPath ? (openBlock(), createBlock("div", {
              key: 0,
              class: [{"uni-tabbar__icon__diff": !item.text}, "uni-tabbar__icon"]
            }, [
              createVNode("img", {
                src: _ctx._getRealPath(_ctx.$route.meta.pagePath === item.pagePath ? item.selectedIconPath : item.iconPath)
              }, null, 8, ["src"]),
              item.redDot ? (openBlock(), createBlock("div", {
                key: 0,
                class: [{"uni-tabbar__badge": !!item.badge}, "uni-tabbar__reddot"]
              }, toDisplayString(item.badge), 3)) : createCommentVNode("v-if", true)
            ], 2)) : createCommentVNode("v-if", true),
            item.text ? (openBlock(), createBlock("div", {
              key: 1,
              style: {color: _ctx.$route.meta.pagePath === item.pagePath ? _ctx.selectedColor : _ctx.color, fontSize: item.iconPath ? "10px" : "14px"},
              class: "uni-tabbar__label"
            }, [
              createTextVNode(toDisplayString(item.text) + " ", 1),
              item.redDot && !item.iconPath ? (openBlock(), createBlock("div", {
                key: 0,
                class: [{"uni-tabbar__badge": !!item.badge}, "uni-tabbar__reddot"]
              }, toDisplayString(item.badge), 3)) : createCommentVNode("v-if", true)
            ], 4)) : createCommentVNode("v-if", true)
          ])
        ], 8, ["onClick"]);
      }), 128))
    ], 4),
    _hoisted_2
  ]);
}
;
script.render = render;
script.__file = "packages/uni-h5/src/framework/components/app/tabBar.vue";
fxy060608's avatar
fxy060608 已提交
832 833
var Transtion = {
  methods: {
fxy060608's avatar
fxy060608 已提交
834 835 836 837
    beforeTransition() {
    },
    afterTransition() {
    }
fxy060608's avatar
fxy060608 已提交
838
  }
fxy060608's avatar
fxy060608 已提交
839
};
fxy060608's avatar
fxy060608 已提交
840
var script$1 = {
fxy060608's avatar
fxy060608 已提交
841
  name: "Toast",
fxy060608's avatar
fxy060608 已提交
842 843 844 845
  mixins: [Transtion],
  props: {
    title: {
      type: String,
fxy060608's avatar
fxy060608 已提交
846
      default: ""
fxy060608's avatar
fxy060608 已提交
847 848
    },
    icon: {
fxy060608's avatar
fxy060608 已提交
849
      default: "success",
fxy060608's avatar
fxy060608 已提交
850
      validator(value) {
fxy060608's avatar
fxy060608 已提交
851
        return ["success", "loading", "none"].indexOf(value) !== -1;
fxy060608's avatar
fxy060608 已提交
852 853 854 855
      }
    },
    image: {
      type: String,
fxy060608's avatar
fxy060608 已提交
856
      default: ""
fxy060608's avatar
fxy060608 已提交
857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872
    },
    duration: {
      type: Number,
      default: 1500
    },
    mask: {
      type: Boolean,
      default: false
    },
    visible: {
      type: Boolean,
      default: false
    }
  },
  computed: {
    iconClass() {
fxy060608's avatar
fxy060608 已提交
873 874
      if (this.icon === "success") {
        return "uni-icon-success-no-circle";
fxy060608's avatar
fxy060608 已提交
875
      }
fxy060608's avatar
fxy060608 已提交
876 877
      if (this.icon === "loading") {
        return "uni-loading";
fxy060608's avatar
fxy060608 已提交
878
      }
fxy060608's avatar
fxy060608 已提交
879
      return "";
fxy060608's avatar
fxy060608 已提交
880 881 882 883
    }
  },
  beforeUpdate() {
    if (this.visible) {
fxy060608's avatar
fxy060608 已提交
884
      this.timeoutId && clearTimeout(this.timeoutId);
fxy060608's avatar
fxy060608 已提交
885
      this.timeoutId = setTimeout(() => {
fxy060608's avatar
fxy060608 已提交
886 887
        UniServiceJSBridge.emit("onHideToast");
      }, this.duration);
fxy060608's avatar
fxy060608 已提交
888 889
    }
  }
fxy060608's avatar
fxy060608 已提交
890
};
fxy060608's avatar
fxy060608 已提交
891 892
const _hoisted_1$1 = {
  key: 1,
fxy060608's avatar
fxy060608 已提交
893 894 895
  class: "uni-sample-toast"
};
const _hoisted_2$1 = {class: "uni-simple-toast__text"};
fxy060608's avatar
fxy060608 已提交
896 897
const _hoisted_3 = {
  key: 2,
fxy060608's avatar
fxy060608 已提交
898 899 900
  class: "uni-toast"
};
const _hoisted_4 = {class: "uni-toast__content"};
fxy060608's avatar
fxy060608 已提交
901
function render$1(_ctx, _cache, $props, $setup, $data, $options) {
fxy060608's avatar
fxy060608 已提交
902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935
  return openBlock(), createBlock(Transition, {name: "uni-fade"}, {
    default: withCtx(() => [
      _ctx.visible ? (openBlock(), createBlock("uni-toast", {
        key: 0,
        "data-duration": _ctx.duration
      }, [
        _ctx.mask ? (openBlock(), createBlock("div", {
          key: 0,
          class: "uni-mask",
          style: {background: "transparent"},
          onTouchmovePassive: _cache[1] || (_cache[1] = withModifiers(() => {
          }, ["prevent"]))
        }, null, 32)) : createCommentVNode("v-if", true),
        !_ctx.image && !_ctx.iconClass ? (openBlock(), createBlock("div", _hoisted_1$1, [
          createVNode("p", _hoisted_2$1, toDisplayString(_ctx.title), 1)
        ])) : (openBlock(), createBlock("div", _hoisted_3, [
          _ctx.image ? (openBlock(), createBlock("img", {
            key: 0,
            src: _ctx.image,
            class: "uni-toast__icon"
          }, null, 8, ["src"])) : (openBlock(), createBlock("i", {
            key: 1,
            class: [_ctx.iconClass, "uni-icon_toast"]
          }, null, 2)),
          createVNode("p", _hoisted_4, toDisplayString(_ctx.title), 1)
        ]))
      ], 8, ["data-duration"])) : createCommentVNode("v-if", true)
    ]),
    _: 1
  });
}
;
script$1.render = render$1;
script$1.__file = "packages/uni-h5/src/framework/components/app/popup/toast.vue";
fxy060608's avatar
fxy060608 已提交
936
var script$2 = {
fxy060608's avatar
fxy060608 已提交
937
  name: "Modal",
fxy060608's avatar
fxy060608 已提交
938 939 940 941
  mixins: [Transtion],
  props: {
    title: {
      type: String,
fxy060608's avatar
fxy060608 已提交
942
      default: ""
fxy060608's avatar
fxy060608 已提交
943 944 945
    },
    content: {
      type: String,
fxy060608's avatar
fxy060608 已提交
946
      default: ""
fxy060608's avatar
fxy060608 已提交
947 948 949 950 951 952 953
    },
    showCancel: {
      type: Boolean,
      default: true
    },
    cancelText: {
      type: String,
fxy060608's avatar
fxy060608 已提交
954
      default: "取消"
fxy060608's avatar
fxy060608 已提交
955 956 957
    },
    cancelColor: {
      type: String,
fxy060608's avatar
fxy060608 已提交
958
      default: "#000000"
fxy060608's avatar
fxy060608 已提交
959 960 961
    },
    confirmText: {
      type: String,
fxy060608's avatar
fxy060608 已提交
962
      default: "确定"
fxy060608's avatar
fxy060608 已提交
963 964 965
    },
    confirmColor: {
      type: String,
fxy060608's avatar
fxy060608 已提交
966
      default: "#007aff"
fxy060608's avatar
fxy060608 已提交
967 968 969 970 971 972 973 974
    },
    visible: {
      type: Boolean,
      default: false
    }
  },
  methods: {
    _close(type) {
fxy060608's avatar
fxy060608 已提交
975
      this.$emit("close", type);
fxy060608's avatar
fxy060608 已提交
976 977
    }
  }
fxy060608's avatar
fxy060608 已提交
978 979 980
};
const _hoisted_1$2 = /* @__PURE__ */ createVNode("div", {class: "uni-mask"}, null, -1);
const _hoisted_2$2 = {class: "uni-modal"};
fxy060608's avatar
fxy060608 已提交
981 982
const _hoisted_3$1 = {
  key: 0,
fxy060608's avatar
fxy060608 已提交
983 984 985
  class: "uni-modal__hd"
};
const _hoisted_4$1 = {class: "uni-modal__ft"};
fxy060608's avatar
fxy060608 已提交
986
function render$2(_ctx, _cache, $props, $setup, $data, $options) {
fxy060608's avatar
fxy060608 已提交
987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030
  return openBlock(), createBlock(Transition, {name: "uni-fade"}, {
    default: withCtx(() => [
      withDirectives(createVNode("uni-modal", {
        onTouchmovePassive: _cache[4] || (_cache[4] = withModifiers(() => {
        }, ["prevent"]))
      }, [
        _hoisted_1$2,
        createVNode("div", _hoisted_2$2, [
          _ctx.title ? (openBlock(), createBlock("div", _hoisted_3$1, [
            createVNode("strong", {
              class: "uni-modal__title",
              textContent: _ctx.title
            }, null, 8, ["textContent"])
          ])) : createCommentVNode("v-if", true),
          createVNode("div", {
            class: "uni-modal__bd",
            onTouchmovePassive: _cache[1] || (_cache[1] = withModifiers(() => {
            }, ["stop"])),
            textContent: _ctx.content
          }, null, 40, ["textContent"]),
          createVNode("div", _hoisted_4$1, [
            _ctx.showCancel ? (openBlock(), createBlock("div", {
              key: 0,
              style: {color: _ctx.cancelColor},
              class: "uni-modal__btn uni-modal__btn_default",
              onClick: _cache[2] || (_cache[2] = ($event) => _ctx._close("cancel"))
            }, toDisplayString(_ctx.cancelText), 5)) : createCommentVNode("v-if", true),
            createVNode("div", {
              style: {color: _ctx.confirmColor},
              class: "uni-modal__btn uni-modal__btn_primary",
              onClick: _cache[3] || (_cache[3] = ($event) => _ctx._close("confirm"))
            }, toDisplayString(_ctx.confirmText), 5)
          ])
        ])
      ], 544), [
        [vShow, _ctx.visible]
      ])
    ]),
    _: 1
  });
}
;
script$2.render = render$2;
script$2.__file = "packages/uni-h5/src/framework/components/app/popup/modal.vue";
fxy060608's avatar
fxy060608 已提交
1031
var script$3 = {
fxy060608's avatar
fxy060608 已提交
1032
  name: "ActionSheet",
fxy060608's avatar
fxy060608 已提交
1033 1034 1035
  props: {
    title: {
      type: String,
fxy060608's avatar
fxy060608 已提交
1036
      default: ""
fxy060608's avatar
fxy060608 已提交
1037 1038 1039 1040
    },
    itemList: {
      type: Array,
      default() {
fxy060608's avatar
fxy060608 已提交
1041
        return [];
fxy060608's avatar
fxy060608 已提交
1042 1043 1044 1045
      }
    },
    itemColor: {
      type: String,
fxy060608's avatar
fxy060608 已提交
1046
      default: "#000000"
fxy060608's avatar
fxy060608 已提交
1047 1048 1049 1050 1051 1052 1053 1054
    },
    visible: {
      type: Boolean,
      default: false
    }
  },
  methods: {
    _close(tapIndex) {
fxy060608's avatar
fxy060608 已提交
1055
      this.$emit("close", tapIndex);
fxy060608's avatar
fxy060608 已提交
1056 1057
    }
  }
fxy060608's avatar
fxy060608 已提交
1058 1059
};
const _hoisted_1$3 = {class: "uni-actionsheet__menu"};
fxy060608's avatar
fxy060608 已提交
1060 1061
const _hoisted_2$3 = {
  key: 0,
fxy060608's avatar
fxy060608 已提交
1062 1063 1064
  class: "uni-actionsheet__title"
};
const _hoisted_3$2 = {class: "uni-actionsheet__action"};
fxy060608's avatar
fxy060608 已提交
1065
function render$3(_ctx, _cache, $props, $setup, $data, $options) {
fxy060608's avatar
fxy060608 已提交
1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107
  return openBlock(), createBlock("uni-actionsheet", {
    onTouchmovePassive: _cache[3] || (_cache[3] = withModifiers(() => {
    }, ["prevent"]))
  }, [
    createVNode(Transition, {name: "uni-fade"}, {
      default: withCtx(() => [
        withDirectives(createVNode("div", {
          class: "uni-mask",
          onClick: _cache[1] || (_cache[1] = ($event) => _ctx._close(-1))
        }, null, 512), [
          [vShow, _ctx.visible]
        ])
      ]),
      _: 1
    }),
    createVNode("div", {
      class: [{"uni-actionsheet_toggle": _ctx.visible}, "uni-actionsheet"]
    }, [
      createVNode("div", _hoisted_1$3, [
        _ctx.title ? (openBlock(), createBlock("div", _hoisted_2$3, toDisplayString(_ctx.title), 1)) : createCommentVNode("v-if", true),
        (openBlock(true), createBlock(Fragment, null, renderList(_ctx.itemList, (itemTitle, index2) => {
          return openBlock(), createBlock("div", {
            key: index2,
            style: {color: _ctx.itemColor},
            class: "uni-actionsheet__cell",
            onClick: ($event) => _ctx._close(index2)
          }, toDisplayString(itemTitle), 13, ["onClick"]);
        }), 128))
      ]),
      createVNode("div", _hoisted_3$2, [
        createVNode("div", {
          style: {color: _ctx.itemColor},
          class: "uni-actionsheet__cell",
          onClick: _cache[2] || (_cache[2] = ($event) => _ctx._close(-1))
        }, " 取消 ", 4)
      ])
    ], 2)
  ], 32);
}
;
script$3.render = render$3;
script$3.__file = "packages/uni-h5/src/framework/components/app/popup/actionSheet.vue";
fxy060608's avatar
fxy060608 已提交
1108 1109 1110 1111
var Components = {
  Toast: script$1,
  Modal: script$2,
  ActionSheet: script$3
fxy060608's avatar
fxy060608 已提交
1112
};
fxy060608's avatar
fxy060608 已提交
1113 1114 1115
var components = {
  TabBar: script,
  ...Components
fxy060608's avatar
fxy060608 已提交
1116
};
fxy060608's avatar
fxy060608 已提交
1117 1118 1119 1120 1121 1122
var ActionSheet = {
  data() {
    return {
      showActionSheet: {
        visible: false
      }
fxy060608's avatar
fxy060608 已提交
1123
    };
fxy060608's avatar
fxy060608 已提交
1124 1125
  },
  created() {
fxy060608's avatar
fxy060608 已提交
1126 1127 1128 1129 1130 1131 1132
    UniServiceJSBridge.on("onShowActionSheet", (args, callback) => {
      this.showActionSheet = args;
      this.onActionSheetCloseCallback = callback;
    });
    UniServiceJSBridge.on("onHidePopup", (args) => {
      this.showActionSheet.visible = false;
    });
fxy060608's avatar
fxy060608 已提交
1133 1134 1135
  },
  methods: {
    _onActionSheetClose(type) {
fxy060608's avatar
fxy060608 已提交
1136 1137
      this.showActionSheet.visible = false;
      isFunction(this.onActionSheetCloseCallback) && this.onActionSheetCloseCallback(type);
fxy060608's avatar
fxy060608 已提交
1138 1139
    }
  }
fxy060608's avatar
fxy060608 已提交
1140
};
fxy060608's avatar
fxy060608 已提交
1141 1142 1143 1144 1145 1146
var Modal = {
  data() {
    return {
      showModal: {
        visible: false
      }
fxy060608's avatar
fxy060608 已提交
1147
    };
fxy060608's avatar
fxy060608 已提交
1148 1149
  },
  created() {
fxy060608's avatar
fxy060608 已提交
1150 1151 1152 1153 1154 1155 1156
    UniServiceJSBridge.on("onShowModal", (args, callback) => {
      this.showModal = args;
      this.onModalCloseCallback = callback;
    });
    UniServiceJSBridge.on("onHidePopup", (args) => {
      this.showModal.visible = false;
    });
fxy060608's avatar
fxy060608 已提交
1157 1158 1159
  },
  methods: {
    _onModalClose(type) {
fxy060608's avatar
fxy060608 已提交
1160 1161
      this.showModal.visible = false;
      isFunction(this.onModalCloseCallback) && this.onModalCloseCallback(type);
fxy060608's avatar
fxy060608 已提交
1162 1163
    }
  }
fxy060608's avatar
fxy060608 已提交
1164
};
fxy060608's avatar
fxy060608 已提交
1165 1166 1167 1168 1169 1170
var Toast = {
  data() {
    return {
      showToast: {
        visible: false
      }
fxy060608's avatar
fxy060608 已提交
1171
    };
fxy060608's avatar
fxy060608 已提交
1172 1173
  },
  created() {
fxy060608's avatar
fxy060608 已提交
1174 1175 1176 1177
    let showType = "";
    const createOnShow = (type) => {
      return (args) => {
        showType = type;
fxy060608's avatar
fxy060608 已提交
1178
        setTimeout(() => {
fxy060608's avatar
fxy060608 已提交
1179 1180 1181 1182 1183 1184 1185
          this.showToast = args;
        }, 10);
      };
    };
    UniServiceJSBridge.on("onShowToast", createOnShow("onShowToast"));
    UniServiceJSBridge.on("onShowLoading", createOnShow("onShowLoading"));
    const createOnHide = (type) => {
fxy060608's avatar
fxy060608 已提交
1186 1187
      return () => {
        if (!showType) {
fxy060608's avatar
fxy060608 已提交
1188
          return;
fxy060608's avatar
fxy060608 已提交
1189
        }
fxy060608's avatar
fxy060608 已提交
1190 1191 1192 1193 1194
        let warnMsg = "";
        if (type === "onHideToast" && showType !== "onShowToast") {
          warnMsg = "请注意 showToast 与 hideToast 必须配对使用";
        } else if (type === "onHideLoading" && showType !== "onShowLoading") {
          warnMsg = "请注意 showLoading 与 hideLoading 必须配对使用";
fxy060608's avatar
fxy060608 已提交
1195 1196
        }
        if (warnMsg) {
fxy060608's avatar
fxy060608 已提交
1197
          return console.warn(warnMsg);
fxy060608's avatar
fxy060608 已提交
1198
        }
fxy060608's avatar
fxy060608 已提交
1199
        showType = "";
fxy060608's avatar
fxy060608 已提交
1200
        setTimeout(() => {
fxy060608's avatar
fxy060608 已提交
1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212
          this.showToast.visible = false;
        }, 10);
      };
    };
    UniServiceJSBridge.on("onHidePopup", createOnHide("onHidePopup"));
    UniServiceJSBridge.on("onHideToast", createOnHide("onHideToast"));
    UniServiceJSBridge.on("onHideLoading", createOnHide("onHideLoading"));
  }
};
var mixins = [ActionSheet, Modal, Toast, Transtion];
var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
var lookup = new Uint8Array(256);
fxy060608's avatar
fxy060608 已提交
1213
for (var i = 0; i < chars.length; i++) {
fxy060608's avatar
fxy060608 已提交
1214
  lookup[chars.charCodeAt(i)] = i;
fxy060608's avatar
fxy060608 已提交
1215 1216
}
var encode = function(arraybuffer) {
fxy060608's avatar
fxy060608 已提交
1217
  var bytes = new Uint8Array(arraybuffer), i, len = bytes.length, base64 = "";
fxy060608's avatar
fxy060608 已提交
1218
  for (i = 0; i < len; i += 3) {
fxy060608's avatar
fxy060608 已提交
1219 1220 1221 1222
    base64 += chars[bytes[i] >> 2];
    base64 += chars[(bytes[i] & 3) << 4 | bytes[i + 1] >> 4];
    base64 += chars[(bytes[i + 1] & 15) << 2 | bytes[i + 2] >> 6];
    base64 += chars[bytes[i + 2] & 63];
fxy060608's avatar
fxy060608 已提交
1223 1224
  }
  if (len % 3 === 2) {
fxy060608's avatar
fxy060608 已提交
1225
    base64 = base64.substring(0, base64.length - 1) + "=";
fxy060608's avatar
fxy060608 已提交
1226
  } else if (len % 3 === 1) {
fxy060608's avatar
fxy060608 已提交
1227
    base64 = base64.substring(0, base64.length - 2) + "==";
fxy060608's avatar
fxy060608 已提交
1228
  }
fxy060608's avatar
fxy060608 已提交
1229 1230
  return base64;
};
fxy060608's avatar
fxy060608 已提交
1231
var decode = function(base64) {
fxy060608's avatar
fxy060608 已提交
1232 1233 1234 1235 1236 1237
  var bufferLength = base64.length * 0.75, len = base64.length, i, p = 0, encoded1, encoded2, encoded3, encoded4;
  if (base64[base64.length - 1] === "=") {
    bufferLength--;
    if (base64[base64.length - 2] === "=") {
      bufferLength--;
    }
fxy060608's avatar
fxy060608 已提交
1238
  }
fxy060608's avatar
fxy060608 已提交
1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250
  var arraybuffer = new ArrayBuffer(bufferLength), bytes = new Uint8Array(arraybuffer);
  for (i = 0; i < len; i += 4) {
    encoded1 = lookup[base64.charCodeAt(i)];
    encoded2 = lookup[base64.charCodeAt(i + 1)];
    encoded3 = lookup[base64.charCodeAt(i + 2)];
    encoded4 = lookup[base64.charCodeAt(i + 3)];
    bytes[p++] = encoded1 << 2 | encoded2 >> 4;
    bytes[p++] = (encoded2 & 15) << 4 | encoded3 >> 2;
    bytes[p++] = (encoded3 & 3) << 6 | encoded4 & 63;
  }
  return arraybuffer;
};
fxy060608's avatar
fxy060608 已提交
1251 1252 1253 1254 1255 1256 1257 1258 1259 1260
const API_TYPE_SYNC = 1;
const API_TYPE_ASYNC = 2;
const API_TYPE_RETURN = 3;
function validateProtocol(name, args, protocol) {
  console.log(name, args, protocol);
  return true;
}
function formatApiArgs(args, options) {
  if (!options) {
    return args;
fxy060608's avatar
fxy060608 已提交
1261
  }
fxy060608's avatar
fxy060608 已提交
1262 1263 1264 1265 1266 1267 1268 1269 1270
}
function createApi({type: type2, name, options}, fn, protocol) {
  return function(...args) {
    if (type2 === API_TYPE_SYNC) {
      if (!(process.env.NODE_ENV !== "production" && protocol && !validateProtocol(name, args, protocol))) {
        return fn.apply(null, formatApiArgs(args, options));
      }
    }
  };
fxy060608's avatar
fxy060608 已提交
1271 1272 1273
}
const Base64ToArrayBufferProtocol = [
  {
fxy060608's avatar
fxy060608 已提交
1274
    name: "base64",
fxy060608's avatar
fxy060608 已提交
1275 1276 1277
    type: String,
    required: true
  }
fxy060608's avatar
fxy060608 已提交
1278
];
fxy060608's avatar
fxy060608 已提交
1279 1280
const ArrayBufferToBase64Protocol = [
  {
fxy060608's avatar
fxy060608 已提交
1281
    name: "arrayBuffer",
fxy060608's avatar
fxy060608 已提交
1282 1283 1284
    type: [ArrayBuffer, Uint8Array],
    required: true
  }
fxy060608's avatar
fxy060608 已提交
1285
];
fxy060608's avatar
fxy060608 已提交
1286
const base64ToArrayBuffer = /* @__PURE__ */ createApi({type: API_TYPE_SYNC, name: "base64ToArrayBuffer"}, (base642) => {
fxy060608's avatar
fxy060608 已提交
1287 1288
  return decode(base642);
}, Base64ToArrayBufferProtocol);
fxy060608's avatar
fxy060608 已提交
1289
const arrayBufferToBase64 = /* @__PURE__ */ createApi({type: API_TYPE_SYNC, name: "arrayBufferToBase64"}, (arrayBuffer) => {
fxy060608's avatar
fxy060608 已提交
1290 1291
  return encode(arrayBuffer);
}, ArrayBufferToBase64Protocol);
fxy060608's avatar
fxy060608 已提交
1292 1293
const Upx2pxProtocol = [
  {
fxy060608's avatar
fxy060608 已提交
1294
    name: "upx",
fxy060608's avatar
fxy060608 已提交
1295 1296 1297
    type: [Number, String],
    required: true
  }
fxy060608's avatar
fxy060608 已提交
1298 1299 1300 1301 1302 1303
];
const EPS = 1e-4;
const BASE_DEVICE_WIDTH = 750;
let isIOS = false;
let deviceWidth = 0;
let deviceDPR = 0;
fxy060608's avatar
fxy060608 已提交
1304
function checkDeviceWidth() {
fxy060608's avatar
fxy060608 已提交
1305 1306 1307 1308
  const {platform, pixelRatio, windowWidth} = __GLOBAL__.getSystemInfoSync();
  deviceWidth = windowWidth;
  deviceDPR = pixelRatio;
  isIOS = platform === "ios";
fxy060608's avatar
fxy060608 已提交
1309
}
fxy060608's avatar
fxy060608 已提交
1310
const upx2px = /* @__PURE__ */ createApi({type: API_TYPE_SYNC, name: "upx2px"}, (number, newDeviceWidth) => {
fxy060608's avatar
fxy060608 已提交
1311
  if (deviceWidth === 0) {
fxy060608's avatar
fxy060608 已提交
1312
    checkDeviceWidth();
fxy060608's avatar
fxy060608 已提交
1313
  }
fxy060608's avatar
fxy060608 已提交
1314
  number = Number(number);
fxy060608's avatar
fxy060608 已提交
1315
  if (number === 0) {
fxy060608's avatar
fxy060608 已提交
1316
    return 0;
fxy060608's avatar
fxy060608 已提交
1317
  }
fxy060608's avatar
fxy060608 已提交
1318
  let result = number / BASE_DEVICE_WIDTH * (newDeviceWidth || deviceWidth);
fxy060608's avatar
fxy060608 已提交
1319
  if (result < 0) {
fxy060608's avatar
fxy060608 已提交
1320
    result = -result;
fxy060608's avatar
fxy060608 已提交
1321
  }
fxy060608's avatar
fxy060608 已提交
1322
  result = Math.floor(result + EPS);
fxy060608's avatar
fxy060608 已提交
1323 1324
  if (result === 0) {
    if (deviceDPR === 1 || !isIOS) {
fxy060608's avatar
fxy060608 已提交
1325
      result = 1;
fxy060608's avatar
fxy060608 已提交
1326
    } else {
fxy060608's avatar
fxy060608 已提交
1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341
      result = 0.5;
    }
  }
  return number < 0 ? -result : result;
}, Upx2pxProtocol);
var HOOKS;
(function(HOOKS2) {
  HOOKS2["INVOKE"] = "invoke";
  HOOKS2["SUCCESS"] = "success";
  HOOKS2["FAIL"] = "fail";
  HOOKS2["COMPLETE"] = "complete";
  HOOKS2["RETURN_VALUE"] = "returnValue";
})(HOOKS || (HOOKS = {}));
const globalInterceptors = {};
const scopedInterceptors = {};
fxy060608's avatar
fxy060608 已提交
1342 1343
const AddInterceptorProtocol = [
  {
fxy060608's avatar
fxy060608 已提交
1344
    name: "method",
fxy060608's avatar
fxy060608 已提交
1345 1346 1347
    type: [String, Object],
    required: true
  }
fxy060608's avatar
fxy060608 已提交
1348 1349
];
const RemoveInterceptorProtocol = AddInterceptorProtocol;
fxy060608's avatar
fxy060608 已提交
1350
function mergeInterceptorHook(interceptors, interceptor3) {
fxy060608's avatar
fxy060608 已提交
1351
  Object.keys(interceptor3).forEach((hook) => {
fxy060608's avatar
fxy060608 已提交
1352
    if (isFunction(interceptor3[hook])) {
fxy060608's avatar
fxy060608 已提交
1353
      interceptors[hook] = mergeHook(interceptors[hook], interceptor3[hook]);
fxy060608's avatar
fxy060608 已提交
1354
    }
fxy060608's avatar
fxy060608 已提交
1355
  });
fxy060608's avatar
fxy060608 已提交
1356 1357 1358
}
function removeInterceptorHook(interceptors, interceptor3) {
  if (!interceptors || !interceptor3) {
fxy060608's avatar
fxy060608 已提交
1359
    return;
fxy060608's avatar
fxy060608 已提交
1360
  }
fxy060608's avatar
fxy060608 已提交
1361
  Object.keys(interceptor3).forEach((hook) => {
fxy060608's avatar
fxy060608 已提交
1362
    if (isFunction(interceptor3[hook])) {
fxy060608's avatar
fxy060608 已提交
1363
      removeHook(interceptors[hook], interceptor3[hook]);
fxy060608's avatar
fxy060608 已提交
1364
    }
fxy060608's avatar
fxy060608 已提交
1365
  });
fxy060608's avatar
fxy060608 已提交
1366 1367
}
function mergeHook(parentVal, childVal) {
fxy060608's avatar
fxy060608 已提交
1368 1369
  const res = childVal ? parentVal ? parentVal.concat(childVal) : isArray(childVal) ? childVal : [childVal] : parentVal;
  return res ? dedupeHooks(res) : res;
fxy060608's avatar
fxy060608 已提交
1370 1371
}
function dedupeHooks(hooks) {
fxy060608's avatar
fxy060608 已提交
1372
  const res = [];
fxy060608's avatar
fxy060608 已提交
1373 1374
  for (let i = 0; i < hooks.length; i++) {
    if (res.indexOf(hooks[i]) === -1) {
fxy060608's avatar
fxy060608 已提交
1375
      res.push(hooks[i]);
fxy060608's avatar
fxy060608 已提交
1376 1377
    }
  }
fxy060608's avatar
fxy060608 已提交
1378
  return res;
fxy060608's avatar
fxy060608 已提交
1379 1380 1381
}
function removeHook(hooks, hook) {
  if (!hooks) {
fxy060608's avatar
fxy060608 已提交
1382
    return;
fxy060608's avatar
fxy060608 已提交
1383
  }
fxy060608's avatar
fxy060608 已提交
1384
  const index2 = hooks.indexOf(hook);
fxy060608's avatar
fxy060608 已提交
1385
  if (index2 !== -1) {
fxy060608's avatar
fxy060608 已提交
1386
    hooks.splice(index2, 1);
fxy060608's avatar
fxy060608 已提交
1387 1388
  }
}
fxy060608's avatar
fxy060608 已提交
1389
const addInterceptor = /* @__PURE__ */ createApi({type: API_TYPE_SYNC, name: "addInterceptor"}, (method, interceptor3) => {
fxy060608's avatar
fxy060608 已提交
1390 1391
  if (typeof method === "string" && isPlainObject(interceptor3)) {
    mergeInterceptorHook(scopedInterceptors[method] || (scopedInterceptors[method] = {}), interceptor3);
fxy060608's avatar
fxy060608 已提交
1392
  } else if (isPlainObject(method)) {
fxy060608's avatar
fxy060608 已提交
1393
    mergeInterceptorHook(globalInterceptors, method);
fxy060608's avatar
fxy060608 已提交
1394
  }
fxy060608's avatar
fxy060608 已提交
1395
}, AddInterceptorProtocol);
fxy060608's avatar
fxy060608 已提交
1396
const removeInterceptor = /* @__PURE__ */ createApi({type: API_TYPE_SYNC, name: "removeInterceptor"}, (method, interceptor3) => {
fxy060608's avatar
fxy060608 已提交
1397
  if (typeof method === "string") {
fxy060608's avatar
fxy060608 已提交
1398
    if (isPlainObject(interceptor3)) {
fxy060608's avatar
fxy060608 已提交
1399
      removeInterceptorHook(scopedInterceptors[method], interceptor3);
fxy060608's avatar
fxy060608 已提交
1400
    } else {
fxy060608's avatar
fxy060608 已提交
1401
      delete scopedInterceptors[method];
fxy060608's avatar
fxy060608 已提交
1402 1403
    }
  } else if (isPlainObject(method)) {
fxy060608's avatar
fxy060608 已提交
1404
    removeInterceptorHook(globalInterceptors, method);
fxy060608's avatar
fxy060608 已提交
1405
  }
fxy060608's avatar
fxy060608 已提交
1406
}, RemoveInterceptorProtocol);
fxy060608's avatar
fxy060608 已提交
1407 1408 1409
const promiseInterceptor = {
  returnValue(res) {
    if (!isPromise(res)) {
fxy060608's avatar
fxy060608 已提交
1410 1411 1412 1413 1414 1415 1416 1417 1418
      return res;
    }
    return res.then((res2) => {
      return res2[1];
    }).catch((res2) => {
      return res2[0];
    });
  }
};
fxy060608's avatar
fxy060608 已提交
1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431
function getCurrentPageVm() {
  const pages = getCurrentPages();
  const len = pages.length;
  const page = pages[len - 1];
  return page && page.$vm;
}
const defaultOptions = {
  thresholds: [0],
  initialRatio: 0,
  observeAll: false
};
let reqComponentObserverId = 1;
const reqComponentObserverCallbacks = {};
fxy060608's avatar
fxy060608 已提交
1432
ServiceJSBridge.subscribe("requestComponentObserver", ({reqId, reqEnd, res}) => {
fxy060608's avatar
fxy060608 已提交
1433 1434 1435 1436 1437 1438 1439
  const callback = reqComponentObserverCallbacks[reqId];
  if (callback) {
    if (reqEnd) {
      return delete reqComponentObserverCallbacks[reqId];
    }
    callback(res);
  }
fxy060608's avatar
fxy060608 已提交
1440
});
fxy060608's avatar
fxy060608 已提交
1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483
class ServiceIntersectionObserver {
  constructor(component, options) {
    this._pageId = component.$page.id;
    this._component = component._$id || component;
    this._options = extend({}, defaultOptions, options || {});
    this._relativeInfo = [];
  }
  relativeTo(selector, margins) {
    if (this._reqId) {
      throw new Error('Relative nodes cannot be added after "observe" call in IntersectionObserver');
    }
    this._relativeInfo.push({
      selector,
      margins
    });
    return this;
  }
  relativeToViewport(margins) {
    return this.relativeTo(null, margins);
  }
  observe(selector, callback) {
    if (typeof callback !== "function") {
      return;
    }
    if (this._reqId) {
      throw new Error('"observe" call can be only called once in IntersectionObserver');
    }
    this._reqId = reqComponentObserverId++;
    reqComponentObserverCallbacks[this._reqId] = callback;
    UniServiceJSBridge.publishHandler("addIntersectionObserver", {
      selector,
      reqId: this._reqId,
      component: this._component,
      options: this._options,
      relativeInfo: this._relativeInfo
    }, this._pageId);
  }
  disconnect() {
    UniServiceJSBridge.publishHandler("removeIntersectionObserver", {
      reqId: this._reqId
    }, this._pageId);
  }
}
fxy060608's avatar
fxy060608 已提交
1484
const createIntersectionObserver$1 = /* @__PURE__ */ createApi({type: API_TYPE_RETURN}, (context, options) => {
fxy060608's avatar
fxy060608 已提交
1485 1486 1487 1488
  if (!context) {
    context = getCurrentPageVm();
  }
  return new ServiceIntersectionObserver(context, options);
fxy060608's avatar
fxy060608 已提交
1489
});
fxy060608's avatar
fxy060608 已提交
1490 1491
const createSelectorQuery$1 = () => {
};
fxy060608's avatar
fxy060608 已提交
1492 1493
const CanIUseProtocol = [
  {
fxy060608's avatar
fxy060608 已提交
1494
    name: "schema",
fxy060608's avatar
fxy060608 已提交
1495 1496 1497
    type: String,
    required: true
  }
fxy060608's avatar
fxy060608 已提交
1498
];
fxy060608's avatar
fxy060608 已提交
1499 1500 1501 1502 1503 1504
const MakePhoneCallProtocol = {
  phoneNumber: {
    type: String,
    required: true,
    validator(phoneNumber) {
      if (!phoneNumber) {
fxy060608's avatar
fxy060608 已提交
1505
        return "makePhoneCall:fail parameter error: parameter.phoneNumber should not be empty String;";
fxy060608's avatar
fxy060608 已提交
1506 1507 1508
      }
    }
  }
fxy060608's avatar
fxy060608 已提交
1509
};
fxy060608's avatar
fxy060608 已提交
1510 1511 1512 1513 1514 1515 1516 1517
const OpenDocumentProtocol = {
  filePath: {
    type: String,
    required: true
  },
  fileType: {
    type: String
  }
fxy060608's avatar
fxy060608 已提交
1518
};
fxy060608's avatar
fxy060608 已提交
1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531
const GetImageInfoOptions = {
  formatArgs: {
    src(src, params) {
      params.src = uni.getRealPath(src);
    }
  }
};
const GetImageInfoProtocol = {
  src: {
    type: String,
    required: true
  }
};
fxy060608's avatar
fxy060608 已提交
1532
function cssSupports(css) {
fxy060608's avatar
fxy060608 已提交
1533
  return window.CSS && window.CSS.supports && window.CSS.supports(css);
fxy060608's avatar
fxy060608 已提交
1534 1535
}
const SCHEMA_CSS = {
fxy060608's avatar
fxy060608 已提交
1536 1537 1538 1539
  "css.var": cssSupports("--a:0"),
  "css.env": cssSupports("top:env(a)"),
  "css.constant": cssSupports("top:constant(a)")
};
fxy060608's avatar
fxy060608 已提交
1540
const canIUse = /* @__PURE__ */ createApi({type: API_TYPE_SYNC, name: "canIUse"}, (schema) => {
fxy060608's avatar
fxy060608 已提交
1541
  if (hasOwn(SCHEMA_CSS, schema)) {
fxy060608's avatar
fxy060608 已提交
1542
    return SCHEMA_CSS[schema];
fxy060608's avatar
fxy060608 已提交
1543
  }
fxy060608's avatar
fxy060608 已提交
1544 1545
  return true;
}, CanIUseProtocol);
fxy060608's avatar
fxy060608 已提交
1546
const makePhoneCall = /* @__PURE__ */ createApi({type: API_TYPE_ASYNC, name: "makePhoneCall"}, (option) => {
fxy060608's avatar
fxy060608 已提交
1547
  window.location.href = `tel:${option.phoneNumber}`;
fxy060608's avatar
fxy060608 已提交
1548 1549 1550 1551
}, MakePhoneCallProtocol);
const ua = navigator.userAgent;
const isAndroid = /android/i.test(ua);
const isIOS$1 = /iphone|ipad|ipod/i.test(ua);
fxy060608's avatar
fxy060608 已提交
1552
const getSystemInfoSync = /* @__PURE__ */ createApi({type: API_TYPE_SYNC}, () => {
fxy060608's avatar
fxy060608 已提交
1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565
  var screen = window.screen;
  var pixelRatio = window.devicePixelRatio;
  const screenFix = /^Apple/.test(navigator.vendor) && typeof window.orientation === "number";
  const landscape = screenFix && Math.abs(window.orientation) === 90;
  var screenWidth = screenFix ? Math[landscape ? "max" : "min"](screen.width, screen.height) : screen.width;
  var screenHeight = screenFix ? Math[landscape ? "min" : "max"](screen.height, screen.width) : screen.height;
  var windowWidth = Math.min(window.innerWidth, document.documentElement.clientWidth, screenWidth) || screenWidth;
  var windowHeight = window.innerHeight;
  var language = navigator.language;
  var statusBarHeight = out.top;
  var osname;
  var osversion;
  var model;
fxy060608's avatar
fxy060608 已提交
1566
  if (isIOS$1) {
fxy060608's avatar
fxy060608 已提交
1567 1568
    osname = "iOS";
    const osversionFind = ua.match(/OS\s([\w_]+)\slike/);
fxy060608's avatar
fxy060608 已提交
1569
    if (osversionFind) {
fxy060608's avatar
fxy060608 已提交
1570
      osversion = osversionFind[1].replace(/_/g, ".");
fxy060608's avatar
fxy060608 已提交
1571
    }
fxy060608's avatar
fxy060608 已提交
1572
    const modelFind = ua.match(/\(([a-zA-Z]+);/);
fxy060608's avatar
fxy060608 已提交
1573
    if (modelFind) {
fxy060608's avatar
fxy060608 已提交
1574
      model = modelFind[1];
fxy060608's avatar
fxy060608 已提交
1575 1576
    }
  } else if (isAndroid) {
fxy060608's avatar
fxy060608 已提交
1577 1578
    osname = "Android";
    const osversionFind = ua.match(/Android[\s/]([\w\.]+)[;\s]/);
fxy060608's avatar
fxy060608 已提交
1579
    if (osversionFind) {
fxy060608's avatar
fxy060608 已提交
1580
      osversion = osversionFind[1];
fxy060608's avatar
fxy060608 已提交
1581
    }
fxy060608's avatar
fxy060608 已提交
1582 1583
    const infoFind = ua.match(/\((.+?)\)/);
    const infos = infoFind ? infoFind[1].split(";") : ua.split(" ");
fxy060608's avatar
fxy060608 已提交
1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594
    const otherInfo = [
      /\bAndroid\b/i,
      /\bLinux\b/i,
      /\bU\b/i,
      /^\s?[a-z][a-z]$/i,
      /^\s?[a-z][a-z]-[a-z][a-z]$/i,
      /\bwv\b/i,
      /\/[\d\.,]+$/,
      /^\s?[\d\.,]+$/,
      /\bBrowser\b/i,
      /\bMobile\b/i
fxy060608's avatar
fxy060608 已提交
1595
    ];
fxy060608's avatar
fxy060608 已提交
1596
    for (let i = 0; i < infos.length; i++) {
fxy060608's avatar
fxy060608 已提交
1597 1598 1599 1600
      const info = infos[i];
      if (info.indexOf("Build") > 0) {
        model = info.split("Build")[0].trim();
        break;
fxy060608's avatar
fxy060608 已提交
1601
      }
fxy060608's avatar
fxy060608 已提交
1602
      let other;
fxy060608's avatar
fxy060608 已提交
1603 1604
      for (let o = 0; o < otherInfo.length; o++) {
        if (otherInfo[o].test(info)) {
fxy060608's avatar
fxy060608 已提交
1605 1606
          other = true;
          break;
fxy060608's avatar
fxy060608 已提交
1607 1608 1609
        }
      }
      if (!other) {
fxy060608's avatar
fxy060608 已提交
1610 1611
        model = info.trim();
        break;
fxy060608's avatar
fxy060608 已提交
1612 1613 1614
      }
    }
  } else {
fxy060608's avatar
fxy060608 已提交
1615 1616
    osname = "Other";
    osversion = "0";
fxy060608's avatar
fxy060608 已提交
1617
  }
fxy060608's avatar
fxy060608 已提交
1618 1619
  var system = `${osname} ${osversion}`;
  var platform = osname.toLocaleLowerCase();
fxy060608's avatar
fxy060608 已提交
1620 1621 1622 1623 1624 1625 1626
  var safeArea = {
    left: out.left,
    right: windowWidth - out.right,
    top: out.top,
    bottom: windowHeight - out.bottom,
    width: windowWidth - out.left - out.right,
    height: windowHeight - out.top - out.bottom
fxy060608's avatar
fxy060608 已提交
1627 1628 1629 1630
  };
  const {top: windowTop, bottom: windowBottom} = getWindowOffset();
  windowHeight -= windowTop;
  windowHeight -= windowBottom;
fxy060608's avatar
fxy060608 已提交
1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650
  return {
    windowTop,
    windowBottom,
    windowWidth,
    windowHeight,
    pixelRatio,
    screenWidth,
    screenHeight,
    language,
    statusBarHeight,
    system,
    platform,
    model,
    safeArea,
    safeAreaInsets: {
      top: out.top,
      right: out.right,
      bottom: out.bottom,
      left: out.left
    }
fxy060608's avatar
fxy060608 已提交
1651 1652
  };
});
fxy060608's avatar
fxy060608 已提交
1653
const getSystemInfo = /* @__PURE__ */ createApi({type: API_TYPE_ASYNC, name: "getSystemInfo"}, () => {
fxy060608's avatar
fxy060608 已提交
1654 1655
  return getSystemInfoSync();
});
fxy060608's avatar
fxy060608 已提交
1656
const openDocument = /* @__PURE__ */ createApi({type: API_TYPE_ASYNC, name: "openDocument"}, (option) => {
fxy060608's avatar
fxy060608 已提交
1657 1658
  window.open(option.filePath);
}, OpenDocumentProtocol);
fxy060608's avatar
fxy060608 已提交
1659 1660 1661
function _getServiceAddress() {
  return window.location.protocol + "//" + window.location.host;
}
fxy060608's avatar
fxy060608 已提交
1662
const getImageInfo = /* @__PURE__ */ createApi({type: API_TYPE_ASYNC, name: "getImageInfo", options: GetImageInfoOptions}, ({src}, callback) => {
fxy060608's avatar
fxy060608 已提交
1663 1664
  const img = new Image();
  img.onload = function() {
fxy060608's avatar
fxy060608 已提交
1665
    callback({
fxy060608's avatar
fxy060608 已提交
1666 1667 1668
      errMsg: "getImageInfo:ok",
      width: img.naturalWidth,
      height: img.naturalHeight,
fxy060608's avatar
fxy060608 已提交
1669
      path: src.indexOf("/") === 0 ? _getServiceAddress() + src : src
fxy060608's avatar
fxy060608 已提交
1670 1671 1672
    });
  };
  img.onerror = function() {
fxy060608's avatar
fxy060608 已提交
1673
    callback({
fxy060608's avatar
fxy060608 已提交
1674 1675 1676 1677
      errMsg: "getImageInfo:fail"
    });
  };
  img.src = src;
fxy060608's avatar
fxy060608 已提交
1678 1679
}, GetImageInfoProtocol);
const navigateBack = /* @__PURE__ */ createApi({type: API_TYPE_ASYNC}, () => {
fxy060608's avatar
fxy060608 已提交
1680
});
fxy060608's avatar
fxy060608 已提交
1681
const navigateTo = /* @__PURE__ */ createApi({type: API_TYPE_ASYNC}, (options) => {
fxy060608's avatar
fxy060608 已提交
1682 1683
  const router = getApp().$router;
  router.push(options.url);
fxy060608's avatar
fxy060608 已提交
1684
});
fxy060608's avatar
fxy060608 已提交
1685
const redirectTo = /* @__PURE__ */ createApi({type: API_TYPE_ASYNC}, () => {
fxy060608's avatar
fxy060608 已提交
1686
});
fxy060608's avatar
fxy060608 已提交
1687
const reLaunch = /* @__PURE__ */ createApi({type: API_TYPE_ASYNC}, () => {
fxy060608's avatar
fxy060608 已提交
1688
});
fxy060608's avatar
fxy060608 已提交
1689
const switchTab = /* @__PURE__ */ createApi({type: API_TYPE_ASYNC}, () => {
fxy060608's avatar
fxy060608 已提交
1690
});
fxy060608's avatar
fxy060608 已提交
1691
const getRealPath = /* @__PURE__ */ createApi({type: API_TYPE_SYNC}, (path) => {
fxy060608's avatar
fxy060608 已提交
1692 1693
  return path;
});
fxy060608's avatar
fxy060608 已提交
1694 1695 1696 1697 1698 1699 1700 1701 1702
var api = /* @__PURE__ */ Object.freeze({
  __proto__: null,
  upx2px,
  addInterceptor,
  removeInterceptor,
  promiseInterceptor,
  arrayBufferToBase64,
  base64ToArrayBuffer,
  createIntersectionObserver: createIntersectionObserver$1,
fxy060608's avatar
fxy060608 已提交
1703
  createSelectorQuery: createSelectorQuery$1,
fxy060608's avatar
fxy060608 已提交
1704 1705 1706 1707 1708
  canIUse,
  makePhoneCall,
  getSystemInfo,
  getSystemInfoSync,
  openDocument,
fxy060608's avatar
fxy060608 已提交
1709
  getImageInfo,
fxy060608's avatar
fxy060608 已提交
1710 1711 1712 1713
  navigateBack,
  navigateTo,
  redirectTo,
  reLaunch,
fxy060608's avatar
fxy060608 已提交
1714 1715
  switchTab,
  getRealPath
fxy060608's avatar
fxy060608 已提交
1716
});
fxy060608's avatar
fxy060608 已提交
1717
var script$4 = {
fxy060608's avatar
fxy060608 已提交
1718
  name: "App",
fxy060608's avatar
fxy060608 已提交
1719 1720 1721 1722 1723 1724
  components,
  mixins,
  props: {
    keepAliveInclude: {
      type: Array,
      default: function() {
fxy060608's avatar
fxy060608 已提交
1725
        return [];
fxy060608's avatar
fxy060608 已提交
1726 1727 1728 1729 1730
      }
    }
  },
  data() {
    return {
fxy060608's avatar
fxy060608 已提交
1731
      transitionName: "fade",
fxy060608's avatar
fxy060608 已提交
1732 1733 1734
      hideTabBar: false,
      tabBar: __uniConfig.tabBar || {},
      sysComponents: this.$sysComponents
fxy060608's avatar
fxy060608 已提交
1735
    };
fxy060608's avatar
fxy060608 已提交
1736 1737 1738
  },
  computed: {
    key() {
fxy060608's avatar
fxy060608 已提交
1739
      return this.$route.meta.name + "-" + this.$route.params.__id__ + "-" + (__uniConfig.reLaunch || 1);
fxy060608's avatar
fxy060608 已提交
1740 1741
    },
    hasTabBar() {
fxy060608's avatar
fxy060608 已提交
1742
      return __uniConfig.tabBar && __uniConfig.tabBar.list && __uniConfig.tabBar.list.length;
fxy060608's avatar
fxy060608 已提交
1743 1744
    },
    showTabBar() {
fxy060608's avatar
fxy060608 已提交
1745
      return this.$route.meta.isTabBar && !this.hideTabBar;
fxy060608's avatar
fxy060608 已提交
1746 1747 1748 1749
    }
  },
  watch: {
    $route(newRoute, oldRoute) {
fxy060608's avatar
fxy060608 已提交
1750
      UniServiceJSBridge.emit("onHidePopup");
fxy060608's avatar
fxy060608 已提交
1751 1752
    },
    hideTabBar(newVal, oldVal) {
fxy060608's avatar
fxy060608 已提交
1753 1754 1755 1756 1757 1758 1759 1760
      if (canIUse("css.var")) {
        const windowBottomValue = !newVal ? TABBAR_HEIGHT : 0;
        const envMethod = canIUse("css.env") ? "env" : canIUse("css.constant") ? "constant" : "";
        const windowBottom = windowBottomValue && envMethod ? `calc(${windowBottomValue}px + ${envMethod}(safe-area-inset-bottom))` : `${windowBottomValue}px`;
        document.documentElement.style.setProperty("--window-bottom", windowBottom);
        console.debug(`uni.${windowBottom ? "showTabBar" : "hideTabBar"}:--window-bottom=${windowBottom}`);
      }
      window.dispatchEvent(new CustomEvent("resize"));
fxy060608's avatar
fxy060608 已提交
1761 1762 1763
    }
  },
  created() {
fxy060608's avatar
fxy060608 已提交
1764 1765
    if (canIUse("css.var")) {
      document.documentElement.style.setProperty("--status-bar-height", "0px");
fxy060608's avatar
fxy060608 已提交
1766 1767 1768
    }
  },
  mounted() {
fxy060608's avatar
fxy060608 已提交
1769 1770 1771 1772 1773 1774 1775 1776
    window.addEventListener("message", function(evt) {
      if (isPlainObject(evt.data) && evt.data.type === "WEB_INVOKE_APPSERVICE") {
        UniServiceJSBridge.emit("onWebInvokeAppService", evt.data.data, evt.data.pageId);
      }
    });
    document.addEventListener("visibilitychange", function() {
      if (document.visibilityState === "visible") {
        UniServiceJSBridge.emit("onAppEnterForeground");
fxy060608's avatar
fxy060608 已提交
1777
      } else {
fxy060608's avatar
fxy060608 已提交
1778
        UniServiceJSBridge.emit("onAppEnterBackground");
fxy060608's avatar
fxy060608 已提交
1779
      }
fxy060608's avatar
fxy060608 已提交
1780
    });
fxy060608's avatar
fxy060608 已提交
1781
  }
fxy060608's avatar
fxy060608 已提交
1782
};
fxy060608's avatar
fxy060608 已提交
1783
function render$4(_ctx, _cache, $props, $setup, $data, $options) {
fxy060608's avatar
fxy060608 已提交
1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816
  const _component_router_view = resolveComponent("router-view");
  const _component_tab_bar = resolveComponent("tab-bar");
  const _component_toast = resolveComponent("toast");
  const _component_action_sheet = resolveComponent("action-sheet");
  const _component_modal = resolveComponent("modal");
  return openBlock(), createBlock("uni-app", {
    class: {"uni-app--showtabbar": _ctx.showTabBar}
  }, [
    createCommentVNode(' <transition :name="transitionName"> '),
    createCommentVNode(" TODO "),
    createVNode(_component_router_view, {key: _ctx.key}, {
      default: withCtx(({Component}) => [
        (openBlock(), createBlock(KeepAlive, {include: _ctx.keepAliveInclude}, [
          (openBlock(), createBlock(resolveDynamicComponent(Component)))
        ], 1032, ["include"]))
      ]),
      _: 1
    }),
    createCommentVNode(" </transition> "),
    _ctx.hasTabBar ? withDirectives(createVNode(_component_tab_bar, mergeProps({key: 0}, _ctx.tabBar), null, 16), [
      [vShow, _ctx.showTabBar]
    ]) : createCommentVNode("v-if", true),
    _ctx.$options.components.Toast ? createVNode(_component_toast, mergeProps({key: 1}, _ctx.showToast), null, 16) : createCommentVNode("v-if", true),
    _ctx.$options.components.ActionSheet ? createVNode(_component_action_sheet, mergeProps({key: 2}, _ctx.showActionSheet, {onClose: _ctx._onActionSheetClose}), null, 16, ["onClose"]) : createCommentVNode("v-if", true),
    _ctx.$options.components.Modal ? createVNode(_component_modal, mergeProps({key: 3}, _ctx.showModal, {onClose: _ctx._onModalClose}), null, 16, ["onClose"]) : createCommentVNode("v-if", true),
    _ctx.sysComponents && _ctx.sysComponents.length ? (openBlock(true), createBlock(Fragment, {key: 4}, renderList(_ctx.sysComponents, (item, index2) => {
      return openBlock(), createBlock(resolveDynamicComponent(item), {key: index2});
    }), 128)) : createCommentVNode("v-if", true)
  ], 2);
}
;
script$4.render = render$4;
script$4.__file = "packages/uni-h5/src/framework/components/app/index.vue";
fxy060608's avatar
fxy060608 已提交
1817
function initSystemComponents(app2) {
fxy060608's avatar
fxy060608 已提交
1818 1819
  script$4.name = COMPONENT_NAME_PREFIX + script$4.name;
  app2.component(script$4.name, script$4);
fxy060608's avatar
fxy060608 已提交
1820 1821 1822
}
var index = {
  install(app) {
fxy060608's avatar
fxy060608 已提交
1823 1824 1825 1826 1827 1828 1829
    initApp(app);
    initView(app);
    initService(app);
    initSystemComponents(app);
    initRouter(app);
  }
};
fxy060608's avatar
fxy060608 已提交
1830 1831 1832 1833 1834
const UniViewJSBridge$1 = extend(ViewJSBridge, {
  publishHandler(event, args, pageId) {
    window.UniServiceJSBridge.subscribeHandler(event, args, pageId);
  }
});
fxy060608's avatar
fxy060608 已提交
1835
const uni$1 = api;
fxy060608's avatar
fxy060608 已提交
1836 1837 1838 1839 1840
const UniServiceJSBridge$1 = extend(ServiceJSBridge, {
  publishHandler(event, args, pageId) {
    window.UniViewJSBridge.subscribeHandler(event, args, pageId);
  }
});
fxy060608's avatar
fxy060608 已提交
1841
let appVm;
fxy060608's avatar
fxy060608 已提交
1842
function getApp$1() {
fxy060608's avatar
fxy060608 已提交
1843
  return appVm;
fxy060608's avatar
fxy060608 已提交
1844 1845
}
function getCurrentPages$1() {
fxy060608's avatar
fxy060608 已提交
1846
  return [];
fxy060608's avatar
fxy060608 已提交
1847 1848 1849
}
function mergeTitleNView(navigationBar, titleNView) {
  if (isPlainObject(titleNView)) {
fxy060608's avatar
fxy060608 已提交
1850 1851
    if (hasOwn(titleNView, "backgroundColor")) {
      navigationBar.backgroundColor = titleNView.backgroundColor;
fxy060608's avatar
fxy060608 已提交
1852
    }
fxy060608's avatar
fxy060608 已提交
1853 1854
    if (hasOwn(titleNView, "buttons")) {
      navigationBar.buttons = titleNView.buttons;
fxy060608's avatar
fxy060608 已提交
1855
    }
fxy060608's avatar
fxy060608 已提交
1856 1857
    if (hasOwn(titleNView, "titleColor")) {
      navigationBar.textColor = titleNView.titleColor;
fxy060608's avatar
fxy060608 已提交
1858
    }
fxy060608's avatar
fxy060608 已提交
1859 1860
    if (hasOwn(titleNView, "titleText")) {
      navigationBar.titleText = titleNView.titleText;
fxy060608's avatar
fxy060608 已提交
1861
    }
fxy060608's avatar
fxy060608 已提交
1862 1863
    if (hasOwn(titleNView, "titleSize")) {
      navigationBar.titleSize = titleNView.titleSize;
fxy060608's avatar
fxy060608 已提交
1864
    }
fxy060608's avatar
fxy060608 已提交
1865 1866
    if (hasOwn(titleNView, "type")) {
      navigationBar.type = titleNView.type;
fxy060608's avatar
fxy060608 已提交
1867
    }
fxy060608's avatar
fxy060608 已提交
1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878
    if (hasOwn(titleNView, "searchInput") && typeof titleNView.searchInput === "object") {
      navigationBar.searchInput = Object.assign({
        autoFocus: false,
        align: "center",
        color: "#000000",
        backgroundColor: "rgba(255,255,255,0.5)",
        borderRadius: "0px",
        placeholder: "",
        placeholderColor: "#CCCCCC",
        disabled: false
      }, titleNView.searchInput);
fxy060608's avatar
fxy060608 已提交
1879 1880
    }
  }
fxy060608's avatar
fxy060608 已提交
1881
  return navigationBar;
fxy060608's avatar
fxy060608 已提交
1882 1883
}
function appendCss(css, cssId, replace = false) {
fxy060608's avatar
fxy060608 已提交
1884
  let style = document.getElementById(cssId);
fxy060608's avatar
fxy060608 已提交
1885
  if (style && replace) {
fxy060608's avatar
fxy060608 已提交
1886 1887
    style.parentNode.removeChild(style);
    style = null;
fxy060608's avatar
fxy060608 已提交
1888 1889
  }
  if (!style) {
fxy060608's avatar
fxy060608 已提交
1890 1891 1892 1893
    style = document.createElement("style");
    style.type = "text/css";
    cssId && (style.id = cssId);
    document.getElementsByTagName("head")[0].appendChild(style);
fxy060608's avatar
fxy060608 已提交
1894
  }
fxy060608's avatar
fxy060608 已提交
1895
  style.appendChild(document.createTextNode(css));
fxy060608's avatar
fxy060608 已提交
1896 1897
}
function hexToRgba(hex) {
fxy060608's avatar
fxy060608 已提交
1898 1899 1900 1901
  let r;
  let g;
  let b;
  hex = hex.replace("#", "");
fxy060608's avatar
fxy060608 已提交
1902
  if (hex.length === 6) {
fxy060608's avatar
fxy060608 已提交
1903 1904 1905
    r = hex.substring(0, 2);
    g = hex.substring(2, 4);
    b = hex.substring(4, 6);
fxy060608's avatar
fxy060608 已提交
1906
  } else if (hex.length === 3) {
fxy060608's avatar
fxy060608 已提交
1907 1908 1909
    r = hex.substring(0, 1);
    g = hex.substring(1, 2);
    b = hex.substring(2, 3);
fxy060608's avatar
fxy060608 已提交
1910
  } else {
fxy060608's avatar
fxy060608 已提交
1911
    return false;
fxy060608's avatar
fxy060608 已提交
1912 1913
  }
  if (r.length === 1) {
fxy060608's avatar
fxy060608 已提交
1914
    r += r;
fxy060608's avatar
fxy060608 已提交
1915 1916
  }
  if (g.length === 1) {
fxy060608's avatar
fxy060608 已提交
1917
    g += g;
fxy060608's avatar
fxy060608 已提交
1918 1919
  }
  if (b.length === 1) {
fxy060608's avatar
fxy060608 已提交
1920
    b += b;
fxy060608's avatar
fxy060608 已提交
1921
  }
fxy060608's avatar
fxy060608 已提交
1922 1923 1924
  r = parseInt(r, 16);
  g = parseInt(g, 16);
  b = parseInt(b, 16);
fxy060608's avatar
fxy060608 已提交
1925 1926 1927 1928
  return {
    r,
    g,
    b
fxy060608's avatar
fxy060608 已提交
1929
  };
fxy060608's avatar
fxy060608 已提交
1930 1931 1932
}
var transparent = {
  mounted() {
fxy060608's avatar
fxy060608 已提交
1933 1934 1935 1936 1937 1938
    if (this.type === "transparent") {
      const transparentElemStyle = this.$el.querySelector(".uni-page-head-transparent").style;
      const titleElem = this.$el.querySelector(".uni-page-head__title");
      const iconElems = this.$el.querySelectorAll(".uni-btn-icon");
      const iconElemsStyles = [];
      const textColor = this.textColor;
fxy060608's avatar
fxy060608 已提交
1939
      for (let i = 0; i < iconElems.length; i++) {
fxy060608's avatar
fxy060608 已提交
1940
        iconElemsStyles.push(iconElems[i].style);
fxy060608's avatar
fxy060608 已提交
1941
      }
fxy060608's avatar
fxy060608 已提交
1942 1943 1944
      const borderRadiusElems = this.$el.querySelectorAll(".uni-page-head-btn");
      const oldColors = [];
      const borderRadiusElemsStyles = [];
fxy060608's avatar
fxy060608 已提交
1945
      for (let i = 0; i < borderRadiusElems.length; i++) {
fxy060608's avatar
fxy060608 已提交
1946 1947 1948
        const borderRadiusElem = borderRadiusElems[i];
        oldColors.push(getComputedStyle(borderRadiusElem).backgroundColor);
        borderRadiusElemsStyles.push(borderRadiusElem.style);
fxy060608's avatar
fxy060608 已提交
1949
      }
fxy060608's avatar
fxy060608 已提交
1950 1951 1952
      this._A = 0;
      UniViewJSBridge.on("onPageScroll", ({scrollTop}) => {
        const alpha = Math.min(scrollTop / this.offset, 1);
fxy060608's avatar
fxy060608 已提交
1953
        if (alpha === 1 && this._A === 1) {
fxy060608's avatar
fxy060608 已提交
1954
          return;
fxy060608's avatar
fxy060608 已提交
1955 1956 1957
        }
        if (alpha > 0.5 && this._A <= 0.5) {
          iconElemsStyles.forEach(function(iconElemStyle) {
fxy060608's avatar
fxy060608 已提交
1958 1959
            iconElemStyle.color = textColor;
          });
fxy060608's avatar
fxy060608 已提交
1960 1961
        } else if (alpha <= 0.5 && this._A > 0.5) {
          iconElemsStyles.forEach(function(iconElemStyle) {
fxy060608's avatar
fxy060608 已提交
1962 1963
            iconElemStyle.color = "#fff";
          });
fxy060608's avatar
fxy060608 已提交
1964
        }
fxy060608's avatar
fxy060608 已提交
1965
        this._A = alpha;
fxy060608's avatar
fxy060608 已提交
1966
        if (titleElem) {
fxy060608's avatar
fxy060608 已提交
1967
          titleElem.style.opacity = alpha;
fxy060608's avatar
fxy060608 已提交
1968
        }
fxy060608's avatar
fxy060608 已提交
1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979
        transparentElemStyle.backgroundColor = `rgba(${this._R},${this._G},${this._B},${alpha})`;
        borderRadiusElemsStyles.forEach(function(borderRadiusElemStyle, index2) {
          const oldColor = oldColors[index2];
          let rgba = oldColor.match(/[\d+\.]+/g);
          rgba[3] = (1 - alpha) * (rgba.length === 4 ? rgba[3] : 1);
          borderRadiusElemStyle.backgroundColor = `rgba(${rgba})`;
        });
      });
    } else if (this.type === "float") {
      const iconElems = this.$el.querySelectorAll(".uni-btn-icon");
      const iconElemsStyles = [];
fxy060608's avatar
fxy060608 已提交
1980
      for (let i = 0; i < iconElems.length; i++) {
fxy060608's avatar
fxy060608 已提交
1981
        iconElemsStyles.push(iconElems[i].style);
fxy060608's avatar
fxy060608 已提交
1982
      }
fxy060608's avatar
fxy060608 已提交
1983 1984 1985
      const borderRadiusElems = this.$el.querySelectorAll(".uni-page-head-btn");
      const oldColors = [];
      const borderRadiusElemsStyles = [];
fxy060608's avatar
fxy060608 已提交
1986
      for (let i = 0; i < borderRadiusElems.length; i++) {
fxy060608's avatar
fxy060608 已提交
1987 1988 1989
        const borderRadiusElem = borderRadiusElems[i];
        oldColors.push(getComputedStyle(borderRadiusElem).backgroundColor);
        borderRadiusElemsStyles.push(borderRadiusElem.style);
fxy060608's avatar
fxy060608 已提交
1990 1991 1992 1993 1994
      }
    }
  },
  computed: {
    color() {
fxy060608's avatar
fxy060608 已提交
1995
      return this.type === "transparent" ? "#fff" : this.textColor;
fxy060608's avatar
fxy060608 已提交
1996 1997
    },
    offset() {
fxy060608's avatar
fxy060608 已提交
1998
      return parseInt(this.coverage);
fxy060608's avatar
fxy060608 已提交
1999 2000
    },
    bgColor() {
fxy060608's avatar
fxy060608 已提交
2001 2002 2003 2004 2005 2006
      if (this.type === "transparent") {
        const {r, g, b} = hexToRgba(this.backgroundColor);
        this._R = r;
        this._G = g;
        this._B = b;
        return `rgba(${r},${g},${b},0)`;
fxy060608's avatar
fxy060608 已提交
2007
      }
fxy060608's avatar
fxy060608 已提交
2008
      return this.backgroundColor;
fxy060608's avatar
fxy060608 已提交
2009 2010
    }
  }
fxy060608's avatar
fxy060608 已提交
2011
};
fxy060608's avatar
fxy060608 已提交
2012
const FONTS = {
fxy060608's avatar
fxy060608 已提交
2013 2014 2015 2016 2017 2018 2019 2020
  forward: "&#xe600;",
  back: "&#xe601;",
  share: "&#xe602;",
  favorite: "&#xe604;",
  home: "&#xe605;",
  menu: "&#xe606;",
  close: "&#xe650;"
};
fxy060608's avatar
fxy060608 已提交
2021
var script$5 = {
fxy060608's avatar
fxy060608 已提交
2022
  name: "PageHead",
fxy060608's avatar
fxy060608 已提交
2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034
  mixins: [transparent],
  components: {
    VUniInput: Input
  },
  props: {
    backButton: {
      type: Boolean,
      default: true
    },
    backgroundColor: {
      type: String,
      default() {
fxy060608's avatar
fxy060608 已提交
2035
        return this.type === "transparent" ? "#000" : "#F8F8F8";
fxy060608's avatar
fxy060608 已提交
2036 2037 2038 2039
      }
    },
    textColor: {
      type: String,
fxy060608's avatar
fxy060608 已提交
2040
      default: "#fff"
fxy060608's avatar
fxy060608 已提交
2041 2042 2043
    },
    titleText: {
      type: String,
fxy060608's avatar
fxy060608 已提交
2044
      default: ""
fxy060608's avatar
fxy060608 已提交
2045 2046 2047
    },
    duration: {
      type: String,
fxy060608's avatar
fxy060608 已提交
2048
      default: "0"
fxy060608's avatar
fxy060608 已提交
2049 2050 2051
    },
    timingFunc: {
      type: String,
fxy060608's avatar
fxy060608 已提交
2052
      default: ""
fxy060608's avatar
fxy060608 已提交
2053 2054 2055 2056 2057 2058 2059
    },
    loading: {
      type: Boolean,
      default: false
    },
    titleSize: {
      type: String,
fxy060608's avatar
fxy060608 已提交
2060
      default: "16px"
fxy060608's avatar
fxy060608 已提交
2061 2062
    },
    type: {
fxy060608's avatar
fxy060608 已提交
2063
      default: "default",
fxy060608's avatar
fxy060608 已提交
2064
      validator(value) {
fxy060608's avatar
fxy060608 已提交
2065
        return ["default", "transparent", "float"].indexOf(value) !== -1;
fxy060608's avatar
fxy060608 已提交
2066 2067 2068 2069
      }
    },
    coverage: {
      type: String,
fxy060608's avatar
fxy060608 已提交
2070
      default: "132px"
fxy060608's avatar
fxy060608 已提交
2071 2072 2073 2074
    },
    buttons: {
      type: Array,
      default() {
fxy060608's avatar
fxy060608 已提交
2075
        return [];
fxy060608's avatar
fxy060608 已提交
2076 2077 2078 2079 2080
      }
    },
    searchInput: {
      type: [Object, Boolean],
      default() {
fxy060608's avatar
fxy060608 已提交
2081
        return false;
fxy060608's avatar
fxy060608 已提交
2082 2083 2084 2085
      }
    },
    titleImage: {
      type: String,
fxy060608's avatar
fxy060608 已提交
2086
      default: ""
fxy060608's avatar
fxy060608 已提交
2087 2088 2089 2090 2091 2092 2093 2094
    },
    titlePenetrate: {
      type: Boolean,
      default: false
    },
    shadow: {
      type: Object,
      default() {
fxy060608's avatar
fxy060608 已提交
2095
        return {};
fxy060608's avatar
fxy060608 已提交
2096 2097 2098 2099 2100 2101
      }
    }
  },
  data() {
    return {
      focus: false,
fxy060608's avatar
fxy060608 已提交
2102
      text: "",
fxy060608's avatar
fxy060608 已提交
2103
      composing: false
fxy060608's avatar
fxy060608 已提交
2104
    };
fxy060608's avatar
fxy060608 已提交
2105 2106 2107
  },
  computed: {
    btns() {
fxy060608's avatar
fxy060608 已提交
2108 2109
      const btns = [];
      const fonts = {};
fxy060608's avatar
fxy060608 已提交
2110
      if (this.buttons.length) {
fxy060608's avatar
fxy060608 已提交
2111 2112
        this.buttons.forEach((button) => {
          const btn = Object.assign({}, button);
fxy060608's avatar
fxy060608 已提交
2113
          if (btn.fontSrc && !btn.fontFamily) {
fxy060608's avatar
fxy060608 已提交
2114 2115
            const fontSrc = btn.fontSrc = this.$getRealPath(btn.fontSrc);
            let fontFamily;
fxy060608's avatar
fxy060608 已提交
2116
            if (fontSrc in fonts) {
fxy060608's avatar
fxy060608 已提交
2117
              fontFamily = fonts[fontSrc];
fxy060608's avatar
fxy060608 已提交
2118
            } else {
fxy060608's avatar
fxy060608 已提交
2119 2120 2121 2122
              fontFamily = `font${Date.now()}`;
              fonts[fontSrc] = fontFamily;
              const cssText = `@font-face{font-family: "${fontFamily}";src: url("${fontSrc}") format("truetype")}`;
              appendCss(cssText, "uni-btn-font-" + fontFamily);
fxy060608's avatar
fxy060608 已提交
2123
            }
fxy060608's avatar
fxy060608 已提交
2124
            btn.fontFamily = fontFamily;
fxy060608's avatar
fxy060608 已提交
2125
          }
fxy060608's avatar
fxy060608 已提交
2126 2127
          btn.color = this.type === "transparent" ? "#fff" : btn.color || this.textColor;
          let fontSize = btn.fontSize || (this.type === "transparent" || /\\u/.test(btn.text) ? "22px" : "27px");
fxy060608's avatar
fxy060608 已提交
2128
          if (/\d$/.test(fontSize)) {
fxy060608's avatar
fxy060608 已提交
2129
            fontSize += "px";
fxy060608's avatar
fxy060608 已提交
2130
          }
fxy060608's avatar
fxy060608 已提交
2131 2132 2133 2134
          btn.fontSize = fontSize;
          btn.fontWeight = btn.fontWeight || "normal";
          btns.push(btn);
        });
fxy060608's avatar
fxy060608 已提交
2135
      }
fxy060608's avatar
fxy060608 已提交
2136
      return btns;
fxy060608's avatar
fxy060608 已提交
2137 2138
    },
    leftBtns() {
fxy060608's avatar
fxy060608 已提交
2139
      return this.btns.filter((btn) => btn.float === "left");
fxy060608's avatar
fxy060608 已提交
2140 2141
    },
    rightBtns() {
fxy060608's avatar
fxy060608 已提交
2142
      return this.btns.filter((btn) => btn.float !== "left");
fxy060608's avatar
fxy060608 已提交
2143 2144
    },
    headClass() {
fxy060608's avatar
fxy060608 已提交
2145
      const shadowColorType = this.shadow.colorType;
fxy060608's avatar
fxy060608 已提交
2146
      const data = {
fxy060608's avatar
fxy060608 已提交
2147 2148 2149 2150
        "uni-page-head-transparent": this.type === "transparent",
        "uni-page-head-titlePenetrate": this.titlePenetrate,
        "uni-page-head-shadow": shadowColorType
      };
fxy060608's avatar
fxy060608 已提交
2151
      if (shadowColorType) {
fxy060608's avatar
fxy060608 已提交
2152
        data[`uni-page-head-shadow-${shadowColorType}`] = shadowColorType;
fxy060608's avatar
fxy060608 已提交
2153
      }
fxy060608's avatar
fxy060608 已提交
2154
      return data;
fxy060608's avatar
fxy060608 已提交
2155 2156 2157 2158
    }
  },
  mounted() {
    if (this.searchInput) {
fxy060608's avatar
fxy060608 已提交
2159 2160 2161 2162
      const input = this.$refs.input;
      input.$watch("composing", (val) => {
        this.composing = val;
      });
fxy060608's avatar
fxy060608 已提交
2163
      if (this.searchInput.disabled) {
fxy060608's avatar
fxy060608 已提交
2164 2165 2166
        input.$el.addEventListener("click", () => {
          UniServiceJSBridge.emit("onNavigationBarSearchInputClicked", "");
        });
fxy060608's avatar
fxy060608 已提交
2167
      } else {
fxy060608's avatar
fxy060608 已提交
2168 2169 2170
        input.$refs.input.addEventListener("keyup", (event) => {
          if (event.key.toUpperCase() === "ENTER") {
            UniServiceJSBridge.emit("onNavigationBarSearchInputConfirmed", {
fxy060608's avatar
fxy060608 已提交
2171
              text: this.text
fxy060608's avatar
fxy060608 已提交
2172
            });
fxy060608's avatar
fxy060608 已提交
2173
          }
fxy060608's avatar
fxy060608 已提交
2174 2175 2176
        });
        input.$refs.input.addEventListener("focus", () => {
          UniServiceJSBridge.emit("onNavigationBarSearchInputFocusChanged", {
fxy060608's avatar
fxy060608 已提交
2177
            focus: true
fxy060608's avatar
fxy060608 已提交
2178 2179 2180 2181
          });
        });
        input.$refs.input.addEventListener("blur", () => {
          UniServiceJSBridge.emit("onNavigationBarSearchInputFocusChanged", {
fxy060608's avatar
fxy060608 已提交
2182
            focus: false
fxy060608's avatar
fxy060608 已提交
2183 2184
          });
        });
fxy060608's avatar
fxy060608 已提交
2185 2186 2187 2188 2189 2190 2191
      }
    }
  },
  methods: {
    _back() {
      if (getCurrentPages().length === 1) {
        uni.reLaunch({
fxy060608's avatar
fxy060608 已提交
2192 2193
          url: "/"
        });
fxy060608's avatar
fxy060608 已提交
2194 2195
      } else {
        uni.navigateBack({
fxy060608's avatar
fxy060608 已提交
2196 2197
          from: "backbutton"
        });
fxy060608's avatar
fxy060608 已提交
2198 2199 2200
      }
    },
    _onBtnClick(index2) {
fxy060608's avatar
fxy060608 已提交
2201 2202 2203
      UniServiceJSBridge.emit("onNavigationBarButtonTap", Object.assign({}, this.btns[index2], {
        index: index2
      }));
fxy060608's avatar
fxy060608 已提交
2204 2205 2206
    },
    _formatBtnFontText(btn) {
      if (btn.fontSrc && btn.fontFamily) {
fxy060608's avatar
fxy060608 已提交
2207
        return btn.text.replace("\\u", "&#x");
fxy060608's avatar
fxy060608 已提交
2208
      } else if (FONTS[btn.type]) {
fxy060608's avatar
fxy060608 已提交
2209
        return FONTS[btn.type];
fxy060608's avatar
fxy060608 已提交
2210
      }
fxy060608's avatar
fxy060608 已提交
2211
      return btn.text || "";
fxy060608's avatar
fxy060608 已提交
2212 2213 2214 2215 2216 2217
    },
    _formatBtnStyle(btn) {
      const style = {
        color: btn.color,
        fontSize: btn.fontSize,
        fontWeight: btn.fontWeight
fxy060608's avatar
fxy060608 已提交
2218
      };
fxy060608's avatar
fxy060608 已提交
2219
      if (btn.fontFamily) {
fxy060608's avatar
fxy060608 已提交
2220
        style.fontFamily = btn.fontFamily;
fxy060608's avatar
fxy060608 已提交
2221
      }
fxy060608's avatar
fxy060608 已提交
2222
      return style;
fxy060608's avatar
fxy060608 已提交
2223 2224
    },
    _focus() {
fxy060608's avatar
fxy060608 已提交
2225
      this.focus = true;
fxy060608's avatar
fxy060608 已提交
2226 2227
    },
    _blur() {
fxy060608's avatar
fxy060608 已提交
2228
      this.focus = false;
fxy060608's avatar
fxy060608 已提交
2229 2230
    },
    _input(text) {
fxy060608's avatar
fxy060608 已提交
2231
      UniServiceJSBridge.emit("onNavigationBarSearchInputChanged", {
fxy060608's avatar
fxy060608 已提交
2232
        text
fxy060608's avatar
fxy060608 已提交
2233
      });
fxy060608's avatar
fxy060608 已提交
2234 2235
    }
  }
fxy060608's avatar
fxy060608 已提交
2236 2237
};
const _hoisted_1$4 = {class: "uni-page-head-hd"};
fxy060608's avatar
fxy060608 已提交
2238 2239
const _hoisted_2$4 = {
  key: 0,
fxy060608's avatar
fxy060608 已提交
2240 2241
  class: "uni-page-head-bd"
};
fxy060608's avatar
fxy060608 已提交
2242 2243
const _hoisted_3$3 = {
  key: 0,
fxy060608's avatar
fxy060608 已提交
2244 2245 2246
  class: "uni-loading"
};
const _hoisted_4$2 = {class: "uni-page-head-ft"};
fxy060608's avatar
fxy060608 已提交
2247
function render$5(_ctx, _cache, $props, $setup, $data, $options) {
fxy060608's avatar
fxy060608 已提交
2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348
  const _component_VUniInput = resolveComponent("VUniInput");
  return openBlock(), createBlock("uni-page-head", {"uni-page-head-type": _ctx.type}, [
    createVNode("div", {
      style: {transitionDuration: _ctx.duration, transitionTimingFunction: _ctx.timingFunc, backgroundColor: _ctx.bgColor, color: _ctx.textColor},
      class: [_ctx.headClass, "uni-page-head"]
    }, [
      createVNode("div", _hoisted_1$4, [
        withDirectives(createVNode("div", {
          class: "uni-page-head-btn",
          onClick: _cache[1] || (_cache[1] = (...args) => _ctx._back(...args))
        }, [
          createVNode("i", {
            style: {color: _ctx.color, fontSize: "27px"},
            class: "uni-btn-icon"
          }, "", 4)
        ], 512), [
          [vShow, _ctx.backButton]
        ]),
        (openBlock(true), createBlock(Fragment, null, renderList(_ctx.leftBtns, (btn, index2) => {
          return openBlock(), createBlock("div", {
            key: index2,
            style: {backgroundColor: _ctx.type === "transparent" ? btn.background : "transparent", width: btn.width},
            "badge-text": btn.badgeText,
            class: [{"uni-page-head-btn-red-dot": btn.redDot || btn.badgeText, "uni-page-head-btn-select": btn.select}, "uni-page-head-btn"]
          }, [
            createVNode("i", {
              style: _ctx._formatBtnStyle(btn),
              class: "uni-btn-icon",
              onClick: ($event) => _ctx._onBtnClick(index2),
              innerHTML: _ctx._formatBtnFontText(btn)
            }, null, 12, ["onClick", "innerHTML"])
          ], 14, ["badge-text"]);
        }), 128))
      ]),
      !_ctx.searchInput ? (openBlock(), createBlock("div", _hoisted_2$4, [
        createVNode("div", {
          style: {fontSize: _ctx.titleSize, opacity: _ctx.type === "transparent" ? 0 : 1},
          class: "uni-page-head__title"
        }, [
          _ctx.loading ? (openBlock(), createBlock("i", _hoisted_3$3)) : createCommentVNode("v-if", true),
          _ctx.titleImage !== "" ? (openBlock(), createBlock("img", {
            key: 1,
            src: _ctx.titleImage,
            class: "uni-page-head__title_image"
          }, null, 8, ["src"])) : (openBlock(), createBlock(Fragment, {key: 2}, [
            createTextVNode(toDisplayString(_ctx.titleText), 1)
          ], 64))
        ], 4)
      ])) : createCommentVNode("v-if", true),
      _ctx.searchInput ? (openBlock(), createBlock("div", {
        key: 1,
        style: {"border-radius": _ctx.searchInput.borderRadius, "background-color": _ctx.searchInput.backgroundColor},
        class: "uni-page-head-search"
      }, [
        createVNode("div", {
          style: {color: _ctx.searchInput.placeholderColor},
          class: [[`uni-page-head-search-placeholder-${_ctx.focus || _ctx.text ? "left" : _ctx.searchInput.align}`], "uni-page-head-search-placeholder"],
          textContent: _ctx.text || _ctx.composing ? "" : _ctx.searchInput.placeholder
        }, null, 14, ["textContent"]),
        createVNode(_component_VUniInput, {
          ref: "input",
          modelValue: _ctx.text,
          "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => _ctx.text = $event),
          focus: _ctx.searchInput.autoFocus,
          disabled: _ctx.searchInput.disabled,
          style: {color: _ctx.searchInput.color},
          "placeholder-style": `color:${_ctx.searchInput.placeholderColor}`,
          class: "uni-page-head-search-input",
          "confirm-type": "search",
          onFocus: _ctx._focus,
          onBlur: _ctx._blur,
          "onUpdate:value": _ctx._input
        }, null, 8, ["modelValue", "focus", "disabled", "style", "placeholder-style", "onFocus", "onBlur", "onUpdate:value"])
      ], 4)) : createCommentVNode("v-if", true),
      createVNode("div", _hoisted_4$2, [
        (openBlock(true), createBlock(Fragment, null, renderList(_ctx.rightBtns, (btn, index2) => {
          return openBlock(), createBlock("div", {
            key: index2,
            style: {backgroundColor: _ctx.type === "transparent" ? btn.background : "transparent", width: btn.width},
            "badge-text": btn.badgeText,
            class: [{"uni-page-head-btn-red-dot": btn.redDot || btn.badgeText, "uni-page-head-btn-select": btn.select}, "uni-page-head-btn"]
          }, [
            createVNode("i", {
              style: _ctx._formatBtnStyle(btn),
              class: "uni-btn-icon",
              onClick: ($event) => _ctx._onBtnClick(index2),
              innerHTML: _ctx._formatBtnFontText(btn)
            }, null, 12, ["onClick", "innerHTML"])
          ], 14, ["badge-text"]);
        }), 128))
      ])
    ], 6),
    _ctx.type !== "transparent" && _ctx.type !== "float" ? (openBlock(), createBlock("div", {
      key: 0,
      class: [{"uni-placeholder-titlePenetrate": _ctx.titlePenetrate}, "uni-placeholder"]
    }, null, 2)) : createCommentVNode("v-if", true)
  ], 8, ["uni-page-head-type"]);
}
;
script$5.render = render$5;
script$5.__file = "packages/uni-h5/src/framework/components/page/pageHead.vue";
fxy060608's avatar
fxy060608 已提交
2349
var script$6 = {
fxy060608's avatar
fxy060608 已提交
2350 2351
  name: "PageBody"
};
fxy060608's avatar
fxy060608 已提交
2352
function render$6(_ctx, _cache, $props, $setup, $data, $options) {
fxy060608's avatar
fxy060608 已提交
2353 2354 2355
  return openBlock(), createBlock("uni-page-wrapper", null, [
    createVNode("uni-page-body", null, [
      renderSlot(_ctx.$slots, "default")
fxy060608's avatar
fxy060608 已提交
2356
    ])
fxy060608's avatar
fxy060608 已提交
2357
  ]);
fxy060608's avatar
fxy060608 已提交
2358
}
fxy060608's avatar
fxy060608 已提交
2359 2360 2361
;
script$6.render = render$6;
script$6.__file = "packages/uni-h5/src/framework/components/page/pageBody.vue";
fxy060608's avatar
fxy060608 已提交
2362
var script$7 = {
fxy060608's avatar
fxy060608 已提交
2363
  name: "PageRefresh",
fxy060608's avatar
fxy060608 已提交
2364 2365 2366
  props: {
    color: {
      type: String,
fxy060608's avatar
fxy060608 已提交
2367
      default: "#2BD009"
fxy060608's avatar
fxy060608 已提交
2368 2369 2370 2371 2372 2373
    },
    offset: {
      type: Number,
      default: 0
    }
  }
fxy060608's avatar
fxy060608 已提交
2374 2375 2376 2377 2378 2379 2380
};
const _hoisted_1$5 = {class: "uni-page-refresh-inner"};
const _hoisted_2$5 = /* @__PURE__ */ createVNode("path", {d: "M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"}, null, -1);
const _hoisted_3$4 = /* @__PURE__ */ createVNode("path", {
  d: "M0 0h24v24H0z",
  fill: "none"
}, null, -1);
fxy060608's avatar
fxy060608 已提交
2381
const _hoisted_4$3 = {
fxy060608's avatar
fxy060608 已提交
2382 2383 2384 2385 2386
  class: "uni-page-refresh__spinner",
  width: "24",
  height: "24",
  viewBox: "25 25 50 50"
};
fxy060608's avatar
fxy060608 已提交
2387
function render$7(_ctx, _cache, $props, $setup, $data, $options) {
fxy060608's avatar
fxy060608 已提交
2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422
  return openBlock(), createBlock("uni-page-refresh", null, [
    createVNode("div", {
      style: {"margin-top": _ctx.offset + "px"},
      class: "uni-page-refresh"
    }, [
      createVNode("div", _hoisted_1$5, [
        (openBlock(), createBlock("svg", {
          fill: _ctx.color,
          class: "uni-page-refresh__icon",
          width: "24",
          height: "24",
          viewBox: "0 0 24 24"
        }, [
          _hoisted_2$5,
          _hoisted_3$4
        ], 8, ["fill"])),
        (openBlock(), createBlock("svg", _hoisted_4$3, [
          createVNode("circle", {
            stroke: _ctx.color,
            class: "uni-page-refresh__path",
            cx: "50",
            cy: "50",
            r: "20",
            fill: "none",
            "stroke-width": "4",
            "stroke-miterlimit": "10"
          }, null, 8, ["stroke"])
        ]))
      ])
    ], 4)
  ]);
}
;
script$7.render = render$7;
script$7.__file = "packages/uni-h5/src/framework/components/page/pageRefresh.vue";
fxy060608's avatar
fxy060608 已提交
2423
function processDeltaY(evt, identifier, startY) {
fxy060608's avatar
fxy060608 已提交
2424
  const touch = Array.prototype.slice.call(evt.changedTouches).filter((touch2) => touch2.identifier === identifier)[0];
fxy060608's avatar
fxy060608 已提交
2425
  if (!touch) {
fxy060608's avatar
fxy060608 已提交
2426
    return false;
fxy060608's avatar
fxy060608 已提交
2427
  }
fxy060608's avatar
fxy060608 已提交
2428 2429
  evt.deltaY = touch.pageY - startY;
  return true;
fxy060608's avatar
fxy060608 已提交
2430
}
fxy060608's avatar
fxy060608 已提交
2431 2432 2433 2434 2435
const PULLING = "pulling";
const REACHED = "reached";
const ABORTING = "aborting";
const REFRESHING = "refreshing";
const RESTORING = "restoring";
fxy060608's avatar
fxy060608 已提交
2436 2437 2438
var pullToRefresh = {
  mounted() {
    if (this.enablePullDownRefresh) {
fxy060608's avatar
fxy060608 已提交
2439 2440 2441 2442 2443 2444 2445 2446 2447 2448
      this.refreshContainerElem = this.$refs.refresh.$el;
      this.refreshControllerElem = this.refreshContainerElem.querySelector(".uni-page-refresh");
      this.refreshInnerElemStyle = this.refreshControllerElem.querySelector(".uni-page-refresh-inner").style;
      UniServiceJSBridge.on(this.$route.params.__id__ + ".startPullDownRefresh", () => {
        if (!this.state) {
          this.state = REFRESHING;
          this._addClass();
          setTimeout(() => {
            this._refreshing();
          }, 50);
fxy060608's avatar
fxy060608 已提交
2449
        }
fxy060608's avatar
fxy060608 已提交
2450 2451 2452 2453 2454 2455 2456 2457 2458 2459
      });
      UniServiceJSBridge.on(this.$route.params.__id__ + ".stopPullDownRefresh", () => {
        if (this.state === REFRESHING) {
          this._removeClass();
          this.state = RESTORING;
          this._addClass();
          this._restoring(() => {
            this._removeClass();
            this.state = this.distance = this.offset = null;
          });
fxy060608's avatar
fxy060608 已提交
2460
        }
fxy060608's avatar
fxy060608 已提交
2461
      });
fxy060608's avatar
fxy060608 已提交
2462 2463 2464 2465
    }
  },
  methods: {
    _touchstart(evt) {
fxy060608's avatar
fxy060608 已提交
2466 2467 2468
      const touch = evt.changedTouches[0];
      this.touchId = touch.identifier;
      this.startY = touch.pageY;
fxy060608's avatar
fxy060608 已提交
2469
      if ([ABORTING, REFRESHING, RESTORING].indexOf(this.state) >= 0) {
fxy060608's avatar
fxy060608 已提交
2470
        this.canRefresh = false;
fxy060608's avatar
fxy060608 已提交
2471
      } else {
fxy060608's avatar
fxy060608 已提交
2472
        this.canRefresh = true;
fxy060608's avatar
fxy060608 已提交
2473 2474 2475 2476
      }
    },
    _touchmove(evt) {
      if (!this.canRefresh) {
fxy060608's avatar
fxy060608 已提交
2477
        return;
fxy060608's avatar
fxy060608 已提交
2478 2479
      }
      if (!processDeltaY(evt, this.touchId, this.startY)) {
fxy060608's avatar
fxy060608 已提交
2480
        return;
fxy060608's avatar
fxy060608 已提交
2481
      }
fxy060608's avatar
fxy060608 已提交
2482 2483 2484 2485
      let {deltaY} = evt;
      if ((document.documentElement.scrollTop || document.body.scrollTop) !== 0) {
        this.touchId = null;
        return;
fxy060608's avatar
fxy060608 已提交
2486 2487
      }
      if (deltaY < 0 && !this.state) {
fxy060608's avatar
fxy060608 已提交
2488
        return;
fxy060608's avatar
fxy060608 已提交
2489
      }
fxy060608's avatar
fxy060608 已提交
2490
      evt.preventDefault();
fxy060608's avatar
fxy060608 已提交
2491
      if (this.distance == null) {
fxy060608's avatar
fxy060608 已提交
2492 2493 2494
        this.offset = deltaY;
        this.state = PULLING;
        this._addClass();
fxy060608's avatar
fxy060608 已提交
2495
      }
fxy060608's avatar
fxy060608 已提交
2496
      deltaY = deltaY - this.offset;
fxy060608's avatar
fxy060608 已提交
2497
      if (deltaY < 0) {
fxy060608's avatar
fxy060608 已提交
2498
        deltaY = 0;
fxy060608's avatar
fxy060608 已提交
2499
      }
fxy060608's avatar
fxy060608 已提交
2500 2501 2502
      this.distance = deltaY;
      const reached = deltaY >= this.refreshOptions.range && this.state !== REACHED;
      const pulling = deltaY < this.refreshOptions.range && this.state !== PULLING;
fxy060608's avatar
fxy060608 已提交
2503
      if (reached || pulling) {
fxy060608's avatar
fxy060608 已提交
2504 2505 2506
        this._removeClass();
        this.state = this.state === REACHED ? PULLING : REACHED;
        this._addClass();
fxy060608's avatar
fxy060608 已提交
2507
      }
fxy060608's avatar
fxy060608 已提交
2508
      this._pulling(deltaY);
fxy060608's avatar
fxy060608 已提交
2509 2510 2511
    },
    _touchend(evt) {
      if (!processDeltaY(evt, this.touchId, this.startY)) {
fxy060608's avatar
fxy060608 已提交
2512
        return;
fxy060608's avatar
fxy060608 已提交
2513 2514
      }
      if (this.state === null) {
fxy060608's avatar
fxy060608 已提交
2515
        return;
fxy060608's avatar
fxy060608 已提交
2516 2517
      }
      if (this.state === PULLING) {
fxy060608's avatar
fxy060608 已提交
2518 2519 2520
        this._removeClass();
        this.state = ABORTING;
        this._addClass();
fxy060608's avatar
fxy060608 已提交
2521
        this._aborting(() => {
fxy060608's avatar
fxy060608 已提交
2522 2523 2524
          this._removeClass();
          this.state = this.distance = this.offset = null;
        });
fxy060608's avatar
fxy060608 已提交
2525
      } else if (this.state === REACHED) {
fxy060608's avatar
fxy060608 已提交
2526 2527 2528 2529
        this._removeClass();
        this.state = REFRESHING;
        this._addClass();
        this._refreshing();
fxy060608's avatar
fxy060608 已提交
2530 2531 2532 2533
      }
    },
    _toggleClass(type) {
      if (!this.state) {
fxy060608's avatar
fxy060608 已提交
2534
        return;
fxy060608's avatar
fxy060608 已提交
2535
      }
fxy060608's avatar
fxy060608 已提交
2536
      const elem = this.refreshContainerElem;
fxy060608's avatar
fxy060608 已提交
2537
      if (elem) {
fxy060608's avatar
fxy060608 已提交
2538
        elem.classList[type]("uni-page-refresh--" + this.state);
fxy060608's avatar
fxy060608 已提交
2539 2540 2541
      }
    },
    _addClass() {
fxy060608's avatar
fxy060608 已提交
2542
      this._toggleClass("add");
fxy060608's avatar
fxy060608 已提交
2543 2544
    },
    _removeClass() {
fxy060608's avatar
fxy060608 已提交
2545
      this._toggleClass("remove");
fxy060608's avatar
fxy060608 已提交
2546 2547
    },
    _pulling(deltaY) {
fxy060608's avatar
fxy060608 已提交
2548
      const elem = this.refreshControllerElem;
fxy060608's avatar
fxy060608 已提交
2549
      if (!elem) {
fxy060608's avatar
fxy060608 已提交
2550
        return;
fxy060608's avatar
fxy060608 已提交
2551
      }
fxy060608's avatar
fxy060608 已提交
2552 2553
      const style = elem.style;
      let rotate = deltaY / this.refreshOptions.range;
fxy060608's avatar
fxy060608 已提交
2554
      if (rotate > 1) {
fxy060608's avatar
fxy060608 已提交
2555
        rotate = 1;
fxy060608's avatar
fxy060608 已提交
2556
      } else {
fxy060608's avatar
fxy060608 已提交
2557
        rotate = rotate * rotate * rotate;
fxy060608's avatar
fxy060608 已提交
2558
      }
fxy060608's avatar
fxy060608 已提交
2559 2560 2561 2562 2563
      const y = Math.round(deltaY / (this.refreshOptions.range / this.refreshOptions.height));
      const transform = y ? "translate3d(-50%, " + y + "px, 0)" : 0;
      style.webkitTransform = transform;
      style.clip = "rect(" + (45 - y) + "px,45px,45px,-5px)";
      this.refreshInnerElemStyle.webkitTransform = "rotate(" + 360 * rotate + "deg)";
fxy060608's avatar
fxy060608 已提交
2564 2565
    },
    _aborting(callback) {
fxy060608's avatar
fxy060608 已提交
2566
      const elem = this.refreshControllerElem;
fxy060608's avatar
fxy060608 已提交
2567
      if (!elem) {
fxy060608's avatar
fxy060608 已提交
2568
        return;
fxy060608's avatar
fxy060608 已提交
2569
      }
fxy060608's avatar
fxy060608 已提交
2570
      const style = elem.style;
fxy060608's avatar
fxy060608 已提交
2571
      if (style.webkitTransform) {
fxy060608's avatar
fxy060608 已提交
2572 2573
        style.webkitTransition = "-webkit-transform 0.3s";
        style.webkitTransform = "translate3d(-50%, 0, 0)";
fxy060608's avatar
fxy060608 已提交
2574
        const abortTransitionEnd = function() {
fxy060608's avatar
fxy060608 已提交
2575 2576 2577 2578 2579 2580 2581
          timeout && clearTimeout(timeout);
          elem.removeEventListener("webkitTransitionEnd", abortTransitionEnd);
          style.webkitTransition = "";
          callback();
        };
        elem.addEventListener("webkitTransitionEnd", abortTransitionEnd);
        const timeout = setTimeout(abortTransitionEnd, 350);
fxy060608's avatar
fxy060608 已提交
2582
      } else {
fxy060608's avatar
fxy060608 已提交
2583
        callback();
fxy060608's avatar
fxy060608 已提交
2584 2585 2586
      }
    },
    _refreshing() {
fxy060608's avatar
fxy060608 已提交
2587
      const elem = this.refreshControllerElem;
fxy060608's avatar
fxy060608 已提交
2588
      if (!elem) {
fxy060608's avatar
fxy060608 已提交
2589 2590 2591 2592 2593 2594
        return;
      }
      const style = elem.style;
      style.webkitTransition = "-webkit-transform 0.2s";
      style.webkitTransform = "translate3d(-50%, " + this.refreshOptions.height + "px, 0)";
      UniServiceJSBridge.emit("onPullDownRefresh", {}, this.$route.params.__id__);
fxy060608's avatar
fxy060608 已提交
2595 2596
    },
    _restoring(callback) {
fxy060608's avatar
fxy060608 已提交
2597
      const elem = this.refreshControllerElem;
fxy060608's avatar
fxy060608 已提交
2598
      if (!elem) {
fxy060608's avatar
fxy060608 已提交
2599
        return;
fxy060608's avatar
fxy060608 已提交
2600
      }
fxy060608's avatar
fxy060608 已提交
2601 2602 2603
      const style = elem.style;
      style.webkitTransition = "-webkit-transform 0.3s";
      style.webkitTransform += " scale(0.01)";
fxy060608's avatar
fxy060608 已提交
2604
      const restoreTransitionEnd = function() {
fxy060608's avatar
fxy060608 已提交
2605 2606 2607 2608 2609 2610 2611 2612
        timeout && clearTimeout(timeout);
        elem.removeEventListener("webkitTransitionEnd", restoreTransitionEnd);
        style.webkitTransition = "";
        style.webkitTransform = "translate3d(-50%, 0, 0)";
        callback();
      };
      elem.addEventListener("webkitTransitionEnd", restoreTransitionEnd);
      const timeout = setTimeout(restoreTransitionEnd, 350);
fxy060608's avatar
fxy060608 已提交
2613 2614
    }
  }
fxy060608's avatar
fxy060608 已提交
2615
};
fxy060608's avatar
fxy060608 已提交
2616
var script$8 = {
fxy060608's avatar
fxy060608 已提交
2617 2618
  name: "Page",
  mpType: "page",
fxy060608's avatar
fxy060608 已提交
2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643
  components: {
    PageHead: script$5,
    PageBody: script$6,
    PageRefresh: script$7
  },
  mixins: [pullToRefresh],
  props: {
    isQuit: {
      type: Boolean,
      default: false
    },
    isEntry: {
      type: Boolean,
      default: false
    },
    isTabBar: {
      type: Boolean,
      default: false
    },
    tabBarIndex: {
      type: Number,
      default: -1
    },
    navigationBarBackgroundColor: {
      type: String,
fxy060608's avatar
fxy060608 已提交
2644
      default: "#000"
fxy060608's avatar
fxy060608 已提交
2645 2646
    },
    navigationBarTextStyle: {
fxy060608's avatar
fxy060608 已提交
2647
      default: "white",
fxy060608's avatar
fxy060608 已提交
2648
      validator(value) {
fxy060608's avatar
fxy060608 已提交
2649
        return ["white", "black"].indexOf(value) !== -1;
fxy060608's avatar
fxy060608 已提交
2650 2651 2652 2653
      }
    },
    navigationBarTitleText: {
      type: String,
fxy060608's avatar
fxy060608 已提交
2654
      default: ""
fxy060608's avatar
fxy060608 已提交
2655 2656
    },
    navigationStyle: {
fxy060608's avatar
fxy060608 已提交
2657
      default: "default",
fxy060608's avatar
fxy060608 已提交
2658
      validator(value) {
fxy060608's avatar
fxy060608 已提交
2659
        return ["default", "custom"].indexOf(value) !== -1;
fxy060608's avatar
fxy060608 已提交
2660 2661 2662 2663
      }
    },
    backgroundColor: {
      type: String,
fxy060608's avatar
fxy060608 已提交
2664
      default: "#ffffff"
fxy060608's avatar
fxy060608 已提交
2665 2666
    },
    backgroundTextStyle: {
fxy060608's avatar
fxy060608 已提交
2667
      default: "dark",
fxy060608's avatar
fxy060608 已提交
2668
      validator(value) {
fxy060608's avatar
fxy060608 已提交
2669
        return ["dark", "light"].indexOf(value) !== -1;
fxy060608's avatar
fxy060608 已提交
2670 2671 2672 2673
      }
    },
    backgroundColorTop: {
      type: String,
fxy060608's avatar
fxy060608 已提交
2674
      default: "#fff"
fxy060608's avatar
fxy060608 已提交
2675 2676 2677
    },
    backgroundColorBottom: {
      type: String,
fxy060608's avatar
fxy060608 已提交
2678
      default: "#fff"
fxy060608's avatar
fxy060608 已提交
2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693
    },
    enablePullDownRefresh: {
      type: Boolean,
      default: false
    },
    onReachBottomDistance: {
      type: Number,
      default: 50
    },
    disableScroll: {
      type: Boolean,
      default: false
    },
    titleNView: {
      type: [Boolean, Object, String],
fxy060608's avatar
fxy060608 已提交
2694
      default: ""
fxy060608's avatar
fxy060608 已提交
2695 2696 2697 2698
    },
    pullToRefresh: {
      type: Object,
      default() {
fxy060608's avatar
fxy060608 已提交
2699
        return {};
fxy060608's avatar
fxy060608 已提交
2700 2701 2702 2703
      }
    },
    titleImage: {
      type: String,
fxy060608's avatar
fxy060608 已提交
2704
      default: ""
fxy060608's avatar
fxy060608 已提交
2705 2706 2707
    },
    transparentTitle: {
      type: String,
fxy060608's avatar
fxy060608 已提交
2708
      default: ""
fxy060608's avatar
fxy060608 已提交
2709 2710 2711
    },
    titlePenetrate: {
      type: String,
fxy060608's avatar
fxy060608 已提交
2712
      default: "NO"
fxy060608's avatar
fxy060608 已提交
2713 2714 2715 2716
    },
    navigationBarShadow: {
      type: Object,
      default() {
fxy060608's avatar
fxy060608 已提交
2717
        return {};
fxy060608's avatar
fxy060608 已提交
2718 2719 2720 2721 2722
      }
    }
  },
  data() {
    const titleNViewTypeList = {
fxy060608's avatar
fxy060608 已提交
2723 2724 2725 2726 2727 2728
      none: "default",
      auto: "transparent",
      always: "float"
    };
    let titleNView = this.titleNView;
    if (titleNView === false || titleNView === "false" || this.navigationStyle === "custom" && !isPlainObject(titleNView) || this.transparentTitle === "always" && !isPlainObject(titleNView)) {
fxy060608's avatar
fxy060608 已提交
2729
      titleNView = {
fxy060608's avatar
fxy060608 已提交
2730 2731
        type: "none"
      };
fxy060608's avatar
fxy060608 已提交
2732
    } else {
fxy060608's avatar
fxy060608 已提交
2733 2734 2735 2736 2737 2738 2739
      titleNView = Object.assign({}, {
        type: this.navigationStyle === "custom" ? "none" : "default"
      }, this.transparentTitle in titleNViewTypeList ? {
        type: titleNViewTypeList[this.transparentTitle]
      } : null, typeof titleNView === "object" ? titleNView : typeof titleNView === "boolean" ? {
        type: titleNView ? "default" : "none"
      } : null);
fxy060608's avatar
fxy060608 已提交
2740 2741 2742 2743
    }
    const yesNoParseList = {
      YES: true,
      NO: false
fxy060608's avatar
fxy060608 已提交
2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771
    };
    const navigationBar = mergeTitleNView({
      loading: false,
      backButton: !this.isQuit && !this.$route.meta.isQuit,
      backgroundColor: this.navigationBarBackgroundColor,
      textColor: this.navigationBarTextStyle === "black" ? "#000" : "#fff",
      titleText: this.navigationBarTitleText,
      titleImage: this.titleImage,
      duration: "0",
      timingFunc: "",
      titlePenetrate: yesNoParseList[this.titlePenetrate]
    }, titleNView);
    navigationBar.shadow = this.navigationBarShadow;
    const refreshOptions = Object.assign({
      support: true,
      color: "#2BD009",
      style: "circle",
      height: 70,
      range: 150,
      offset: 0
    }, this.pullToRefresh);
    let offset = uni.upx2px(refreshOptions.offset);
    if (titleNView.type !== "none" && titleNView.type !== "transparent") {
      offset += NAVBAR_HEIGHT + out.top;
    }
    refreshOptions.offset = offset;
    refreshOptions.height = uni.upx2px(refreshOptions.height);
    refreshOptions.range = uni.upx2px(refreshOptions.range);
fxy060608's avatar
fxy060608 已提交
2772 2773 2774
    return {
      navigationBar,
      refreshOptions
fxy060608's avatar
fxy060608 已提交
2775
    };
fxy060608's avatar
fxy060608 已提交
2776 2777
  },
  created() {
fxy060608's avatar
fxy060608 已提交
2778 2779 2780
    const navigationBar = this.navigationBar;
    document.title = navigationBar.titleText;
    UniServiceJSBridge.emit("onNavigationBarChange", navigationBar);
fxy060608's avatar
fxy060608 已提交
2781
  }
fxy060608's avatar
fxy060608 已提交
2782
};
fxy060608's avatar
fxy060608 已提交
2783
function render$8(_ctx, _cache, $props, $setup, $data, $options) {
fxy060608's avatar
fxy060608 已提交
2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818
  const _component_page_head = resolveComponent("page-head");
  const _component_page_refresh = resolveComponent("page-refresh");
  const _component_page_body = resolveComponent("page-body");
  return openBlock(), createBlock("uni-page", {
    "data-page": _ctx.$route.meta.pagePath
  }, [
    _ctx.navigationBar.type !== "none" ? createVNode(_component_page_head, mergeProps({key: 0}, _ctx.navigationBar), null, 16) : createCommentVNode("v-if", true),
    _ctx.enablePullDownRefresh ? createVNode(_component_page_refresh, {
      key: 1,
      ref: "refresh",
      color: _ctx.refreshOptions.color,
      offset: _ctx.refreshOptions.offset
    }, null, 8, ["color", "offset"]) : createCommentVNode("v-if", true),
    _ctx.enablePullDownRefresh ? createVNode(_component_page_body, {
      key: 2,
      onTouchstartPassive: _ctx._touchstart,
      onTouchmovePassive: _ctx._touchmove,
      onTouchendPassive: _ctx._touchend,
      onTouchcancelPassive: _ctx._touchend
    }, {
      default: withCtx(() => [
        renderSlot(_ctx.$slots, "page")
      ]),
      _: 3
    }, 8, ["onTouchstartPassive", "onTouchmovePassive", "onTouchendPassive", "onTouchcancelPassive"]) : createVNode(_component_page_body, {key: 3}, {
      default: withCtx(() => [
        renderSlot(_ctx.$slots, "page")
      ]),
      _: 3
    })
  ], 8, ["data-page"]);
}
;
script$8.render = render$8;
script$8.__file = "packages/uni-h5/src/framework/components/page/index.vue";
fxy060608's avatar
fxy060608 已提交
2819
var script$9 = {
fxy060608's avatar
fxy060608 已提交
2820
  name: "AsyncError",
fxy060608's avatar
fxy060608 已提交
2821 2822
  methods: {
    _onClick() {
fxy060608's avatar
fxy060608 已提交
2823
      window.location.reload();
fxy060608's avatar
fxy060608 已提交
2824 2825
    }
  }
fxy060608's avatar
fxy060608 已提交
2826
};
fxy060608's avatar
fxy060608 已提交
2827
function render$9(_ctx, _cache, $props, $setup, $data, $options) {
fxy060608's avatar
fxy060608 已提交
2828 2829 2830 2831 2832 2833 2834 2835
  return openBlock(), createBlock("div", {
    class: "uni-async-error",
    onClick: _cache[1] || (_cache[1] = (...args) => _ctx._onClick(...args))
  }, " 连接服务器超时,点击屏幕重试 ");
}
;
script$9.render = render$9;
script$9.__file = "packages/uni-h5/src/framework/components/async-error/index.vue";
fxy060608's avatar
fxy060608 已提交
2836
var script$a = {
fxy060608's avatar
fxy060608 已提交
2837 2838 2839 2840
  name: "AsyncLoading"
};
const _hoisted_1$6 = {class: "uni-async-loading"};
const _hoisted_2$6 = /* @__PURE__ */ createVNode("i", {class: "uni-loading"}, null, -1);
fxy060608's avatar
fxy060608 已提交
2841
function render$a(_ctx, _cache, $props, $setup, $data, $options) {
fxy060608's avatar
fxy060608 已提交
2842 2843 2844 2845 2846 2847 2848
  return openBlock(), createBlock("div", _hoisted_1$6, [
    _hoisted_2$6
  ]);
}
;
script$a.render = render$a;
script$a.__file = "packages/uni-h5/src/framework/components/async-loading/index.vue";
fxy060608's avatar
fxy060608 已提交
2849
export {script$9 as AsyncErrorComponent, script$a as AsyncLoadingComponent, script$8 as PageComponent, UniServiceJSBridge$1 as UniServiceJSBridge, UniViewJSBridge$1 as UniViewJSBridge, addInterceptor, arrayBufferToBase64, base64ToArrayBuffer, canIUse, createIntersectionObserver$1 as createIntersectionObserver, createSelectorQuery$1 as createSelectorQuery, getApp$1 as getApp, getCurrentPages$1 as getCurrentPages, getImageInfo, getRealPath, getSystemInfo, getSystemInfoSync, makePhoneCall, navigateBack, navigateTo, openDocument, index as plugin, promiseInterceptor, reLaunch, redirectTo, removeInterceptor, switchTab, uni$1 as uni, upx2px};