uni-h5.esm.js 82.1 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
function createApi(fn, protocol, options) {
  if (process.env.NODE_ENV !== "production" && protocol)
fxy060608's avatar
fxy060608 已提交
1253
    ;
fxy060608's avatar
fxy060608 已提交
1254 1255
  if (options) {
  }
fxy060608's avatar
fxy060608 已提交
1256
  return fn;
fxy060608's avatar
fxy060608 已提交
1257 1258 1259
}
const Base64ToArrayBufferProtocol = [
  {
fxy060608's avatar
fxy060608 已提交
1260
    name: "base64",
fxy060608's avatar
fxy060608 已提交
1261 1262 1263
    type: String,
    required: true
  }
fxy060608's avatar
fxy060608 已提交
1264
];
fxy060608's avatar
fxy060608 已提交
1265 1266
const ArrayBufferToBase64Protocol = [
  {
fxy060608's avatar
fxy060608 已提交
1267
    name: "arrayBuffer",
fxy060608's avatar
fxy060608 已提交
1268 1269 1270
    type: [ArrayBuffer, Uint8Array],
    required: true
  }
fxy060608's avatar
fxy060608 已提交
1271 1272 1273 1274 1275 1276 1277
];
const base64ToArrayBuffer = /* @__PURE__ */ createApi((base642) => {
  return decode(base642);
}, Base64ToArrayBufferProtocol);
const arrayBufferToBase64 = /* @__PURE__ */ createApi((arrayBuffer) => {
  return encode(arrayBuffer);
}, ArrayBufferToBase64Protocol);
fxy060608's avatar
fxy060608 已提交
1278 1279
const Upx2pxProtocol = [
  {
fxy060608's avatar
fxy060608 已提交
1280
    name: "upx",
fxy060608's avatar
fxy060608 已提交
1281 1282 1283
    type: [Number, String],
    required: true
  }
fxy060608's avatar
fxy060608 已提交
1284 1285 1286 1287 1288 1289
];
const EPS = 1e-4;
const BASE_DEVICE_WIDTH = 750;
let isIOS = false;
let deviceWidth = 0;
let deviceDPR = 0;
fxy060608's avatar
fxy060608 已提交
1290
function checkDeviceWidth() {
fxy060608's avatar
fxy060608 已提交
1291 1292 1293 1294
  const {platform, pixelRatio, windowWidth} = __GLOBAL__.getSystemInfoSync();
  deviceWidth = windowWidth;
  deviceDPR = pixelRatio;
  isIOS = platform === "ios";
fxy060608's avatar
fxy060608 已提交
1295 1296 1297
}
const upx2px = /* @__PURE__ */ createApi((number, newDeviceWidth) => {
  if (deviceWidth === 0) {
fxy060608's avatar
fxy060608 已提交
1298
    checkDeviceWidth();
fxy060608's avatar
fxy060608 已提交
1299
  }
fxy060608's avatar
fxy060608 已提交
1300
  number = Number(number);
fxy060608's avatar
fxy060608 已提交
1301
  if (number === 0) {
fxy060608's avatar
fxy060608 已提交
1302
    return 0;
fxy060608's avatar
fxy060608 已提交
1303
  }
fxy060608's avatar
fxy060608 已提交
1304
  let result = number / BASE_DEVICE_WIDTH * (newDeviceWidth || deviceWidth);
fxy060608's avatar
fxy060608 已提交
1305
  if (result < 0) {
fxy060608's avatar
fxy060608 已提交
1306
    result = -result;
fxy060608's avatar
fxy060608 已提交
1307
  }
fxy060608's avatar
fxy060608 已提交
1308
  result = Math.floor(result + EPS);
fxy060608's avatar
fxy060608 已提交
1309 1310
  if (result === 0) {
    if (deviceDPR === 1 || !isIOS) {
fxy060608's avatar
fxy060608 已提交
1311
      result = 1;
fxy060608's avatar
fxy060608 已提交
1312
    } else {
fxy060608's avatar
fxy060608 已提交
1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327
      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 已提交
1328 1329
const AddInterceptorProtocol = [
  {
fxy060608's avatar
fxy060608 已提交
1330
    name: "method",
fxy060608's avatar
fxy060608 已提交
1331 1332 1333
    type: [String, Object],
    required: true
  }
fxy060608's avatar
fxy060608 已提交
1334 1335
];
const RemoveInterceptorProtocol = AddInterceptorProtocol;
fxy060608's avatar
fxy060608 已提交
1336
function mergeInterceptorHook(interceptors, interceptor3) {
fxy060608's avatar
fxy060608 已提交
1337
  Object.keys(interceptor3).forEach((hook) => {
fxy060608's avatar
fxy060608 已提交
1338
    if (isFunction(interceptor3[hook])) {
fxy060608's avatar
fxy060608 已提交
1339
      interceptors[hook] = mergeHook(interceptors[hook], interceptor3[hook]);
fxy060608's avatar
fxy060608 已提交
1340
    }
fxy060608's avatar
fxy060608 已提交
1341
  });
fxy060608's avatar
fxy060608 已提交
1342 1343 1344
}
function removeInterceptorHook(interceptors, interceptor3) {
  if (!interceptors || !interceptor3) {
fxy060608's avatar
fxy060608 已提交
1345
    return;
fxy060608's avatar
fxy060608 已提交
1346
  }
fxy060608's avatar
fxy060608 已提交
1347
  Object.keys(interceptor3).forEach((hook) => {
fxy060608's avatar
fxy060608 已提交
1348
    if (isFunction(interceptor3[hook])) {
fxy060608's avatar
fxy060608 已提交
1349
      removeHook(interceptors[hook], interceptor3[hook]);
fxy060608's avatar
fxy060608 已提交
1350
    }
fxy060608's avatar
fxy060608 已提交
1351
  });
fxy060608's avatar
fxy060608 已提交
1352 1353
}
function mergeHook(parentVal, childVal) {
fxy060608's avatar
fxy060608 已提交
1354 1355
  const res = childVal ? parentVal ? parentVal.concat(childVal) : isArray(childVal) ? childVal : [childVal] : parentVal;
  return res ? dedupeHooks(res) : res;
fxy060608's avatar
fxy060608 已提交
1356 1357
}
function dedupeHooks(hooks) {
fxy060608's avatar
fxy060608 已提交
1358
  const res = [];
fxy060608's avatar
fxy060608 已提交
1359 1360
  for (let i = 0; i < hooks.length; i++) {
    if (res.indexOf(hooks[i]) === -1) {
fxy060608's avatar
fxy060608 已提交
1361
      res.push(hooks[i]);
fxy060608's avatar
fxy060608 已提交
1362 1363
    }
  }
fxy060608's avatar
fxy060608 已提交
1364
  return res;
fxy060608's avatar
fxy060608 已提交
1365 1366 1367
}
function removeHook(hooks, hook) {
  if (!hooks) {
fxy060608's avatar
fxy060608 已提交
1368
    return;
fxy060608's avatar
fxy060608 已提交
1369
  }
fxy060608's avatar
fxy060608 已提交
1370
  const index2 = hooks.indexOf(hook);
fxy060608's avatar
fxy060608 已提交
1371
  if (index2 !== -1) {
fxy060608's avatar
fxy060608 已提交
1372
    hooks.splice(index2, 1);
fxy060608's avatar
fxy060608 已提交
1373 1374 1375
  }
}
const addInterceptor = /* @__PURE__ */ createApi((method, interceptor3) => {
fxy060608's avatar
fxy060608 已提交
1376 1377
  if (typeof method === "string" && isPlainObject(interceptor3)) {
    mergeInterceptorHook(scopedInterceptors[method] || (scopedInterceptors[method] = {}), interceptor3);
fxy060608's avatar
fxy060608 已提交
1378
  } else if (isPlainObject(method)) {
fxy060608's avatar
fxy060608 已提交
1379
    mergeInterceptorHook(globalInterceptors, method);
fxy060608's avatar
fxy060608 已提交
1380
  }
fxy060608's avatar
fxy060608 已提交
1381
}, AddInterceptorProtocol);
fxy060608's avatar
fxy060608 已提交
1382
const removeInterceptor = /* @__PURE__ */ createApi((method, interceptor3) => {
fxy060608's avatar
fxy060608 已提交
1383
  if (typeof method === "string") {
fxy060608's avatar
fxy060608 已提交
1384
    if (isPlainObject(interceptor3)) {
fxy060608's avatar
fxy060608 已提交
1385
      removeInterceptorHook(scopedInterceptors[method], interceptor3);
fxy060608's avatar
fxy060608 已提交
1386
    } else {
fxy060608's avatar
fxy060608 已提交
1387
      delete scopedInterceptors[method];
fxy060608's avatar
fxy060608 已提交
1388 1389
    }
  } else if (isPlainObject(method)) {
fxy060608's avatar
fxy060608 已提交
1390
    removeInterceptorHook(globalInterceptors, method);
fxy060608's avatar
fxy060608 已提交
1391
  }
fxy060608's avatar
fxy060608 已提交
1392
}, RemoveInterceptorProtocol);
fxy060608's avatar
fxy060608 已提交
1393 1394 1395
const promiseInterceptor = {
  returnValue(res) {
    if (!isPromise(res)) {
fxy060608's avatar
fxy060608 已提交
1396 1397 1398 1399 1400 1401 1402 1403 1404
      return res;
    }
    return res.then((res2) => {
      return res2[1];
    }).catch((res2) => {
      return res2[0];
    });
  }
};
fxy060608's avatar
fxy060608 已提交
1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417
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 已提交
1418
ServiceJSBridge.subscribe("requestComponentObserver", ({reqId, reqEnd, res}) => {
fxy060608's avatar
fxy060608 已提交
1419 1420 1421 1422 1423 1424 1425
  const callback = reqComponentObserverCallbacks[reqId];
  if (callback) {
    if (reqEnd) {
      return delete reqComponentObserverCallbacks[reqId];
    }
    callback(res);
  }
fxy060608's avatar
fxy060608 已提交
1426
});
fxy060608's avatar
fxy060608 已提交
1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 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
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);
  }
}
const createIntersectionObserver$1 = /* @__PURE__ */ createApi((context, options) => {
  if (!context) {
    context = getCurrentPageVm();
  }
  return new ServiceIntersectionObserver(context, options);
fxy060608's avatar
fxy060608 已提交
1475
});
fxy060608's avatar
fxy060608 已提交
1476 1477
const CanIUseProtocol = [
  {
fxy060608's avatar
fxy060608 已提交
1478
    name: "schema",
fxy060608's avatar
fxy060608 已提交
1479 1480 1481
    type: String,
    required: true
  }
fxy060608's avatar
fxy060608 已提交
1482
];
fxy060608's avatar
fxy060608 已提交
1483 1484 1485 1486 1487 1488
const MakePhoneCallProtocol = {
  phoneNumber: {
    type: String,
    required: true,
    validator(phoneNumber) {
      if (!phoneNumber) {
fxy060608's avatar
fxy060608 已提交
1489
        return "makePhoneCall:fail parameter error: parameter.phoneNumber should not be empty String;";
fxy060608's avatar
fxy060608 已提交
1490 1491 1492
      }
    }
  }
fxy060608's avatar
fxy060608 已提交
1493
};
fxy060608's avatar
fxy060608 已提交
1494 1495 1496 1497 1498 1499 1500 1501
const OpenDocumentProtocol = {
  filePath: {
    type: String,
    required: true
  },
  fileType: {
    type: String
  }
fxy060608's avatar
fxy060608 已提交
1502
};
fxy060608's avatar
fxy060608 已提交
1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515
const GetImageInfoOptions = {
  formatArgs: {
    src(src, params) {
      params.src = uni.getRealPath(src);
    }
  }
};
const GetImageInfoProtocol = {
  src: {
    type: String,
    required: true
  }
};
fxy060608's avatar
fxy060608 已提交
1516
function cssSupports(css) {
fxy060608's avatar
fxy060608 已提交
1517
  return window.CSS && window.CSS.supports && window.CSS.supports(css);
fxy060608's avatar
fxy060608 已提交
1518 1519
}
const SCHEMA_CSS = {
fxy060608's avatar
fxy060608 已提交
1520 1521 1522 1523 1524
  "css.var": cssSupports("--a:0"),
  "css.env": cssSupports("top:env(a)"),
  "css.constant": cssSupports("top:constant(a)")
};
const canIUse = /* @__PURE__ */ createApi((schema) => {
fxy060608's avatar
fxy060608 已提交
1525
  if (hasOwn(SCHEMA_CSS, schema)) {
fxy060608's avatar
fxy060608 已提交
1526
    return SCHEMA_CSS[schema];
fxy060608's avatar
fxy060608 已提交
1527
  }
fxy060608's avatar
fxy060608 已提交
1528 1529
  return true;
}, CanIUseProtocol);
fxy060608's avatar
fxy060608 已提交
1530 1531
const makePhoneCall = /* @__PURE__ */ createApi((option) => {
  window.location.href = `tel:${option.phoneNumber}`;
fxy060608's avatar
fxy060608 已提交
1532 1533 1534 1535
}, MakePhoneCallProtocol);
const ua = navigator.userAgent;
const isAndroid = /android/i.test(ua);
const isIOS$1 = /iphone|ipad|ipod/i.test(ua);
fxy060608's avatar
fxy060608 已提交
1536
const getSystemInfoSync = /* @__PURE__ */ createApi(() => {
fxy060608's avatar
fxy060608 已提交
1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549
  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 已提交
1550
  if (isIOS$1) {
fxy060608's avatar
fxy060608 已提交
1551 1552
    osname = "iOS";
    const osversionFind = ua.match(/OS\s([\w_]+)\slike/);
fxy060608's avatar
fxy060608 已提交
1553
    if (osversionFind) {
fxy060608's avatar
fxy060608 已提交
1554
      osversion = osversionFind[1].replace(/_/g, ".");
fxy060608's avatar
fxy060608 已提交
1555
    }
fxy060608's avatar
fxy060608 已提交
1556
    const modelFind = ua.match(/\(([a-zA-Z]+);/);
fxy060608's avatar
fxy060608 已提交
1557
    if (modelFind) {
fxy060608's avatar
fxy060608 已提交
1558
      model = modelFind[1];
fxy060608's avatar
fxy060608 已提交
1559 1560
    }
  } else if (isAndroid) {
fxy060608's avatar
fxy060608 已提交
1561 1562
    osname = "Android";
    const osversionFind = ua.match(/Android[\s/]([\w\.]+)[;\s]/);
fxy060608's avatar
fxy060608 已提交
1563
    if (osversionFind) {
fxy060608's avatar
fxy060608 已提交
1564
      osversion = osversionFind[1];
fxy060608's avatar
fxy060608 已提交
1565
    }
fxy060608's avatar
fxy060608 已提交
1566 1567
    const infoFind = ua.match(/\((.+?)\)/);
    const infos = infoFind ? infoFind[1].split(";") : ua.split(" ");
fxy060608's avatar
fxy060608 已提交
1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578
    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 已提交
1579
    ];
fxy060608's avatar
fxy060608 已提交
1580
    for (let i = 0; i < infos.length; i++) {
fxy060608's avatar
fxy060608 已提交
1581 1582 1583 1584
      const info = infos[i];
      if (info.indexOf("Build") > 0) {
        model = info.split("Build")[0].trim();
        break;
fxy060608's avatar
fxy060608 已提交
1585
      }
fxy060608's avatar
fxy060608 已提交
1586
      let other;
fxy060608's avatar
fxy060608 已提交
1587 1588
      for (let o = 0; o < otherInfo.length; o++) {
        if (otherInfo[o].test(info)) {
fxy060608's avatar
fxy060608 已提交
1589 1590
          other = true;
          break;
fxy060608's avatar
fxy060608 已提交
1591 1592 1593
        }
      }
      if (!other) {
fxy060608's avatar
fxy060608 已提交
1594 1595
        model = info.trim();
        break;
fxy060608's avatar
fxy060608 已提交
1596 1597 1598
      }
    }
  } else {
fxy060608's avatar
fxy060608 已提交
1599 1600
    osname = "Other";
    osversion = "0";
fxy060608's avatar
fxy060608 已提交
1601
  }
fxy060608's avatar
fxy060608 已提交
1602 1603
  var system = `${osname} ${osversion}`;
  var platform = osname.toLocaleLowerCase();
fxy060608's avatar
fxy060608 已提交
1604 1605 1606 1607 1608 1609 1610
  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 已提交
1611 1612 1613 1614
  };
  const {top: windowTop, bottom: windowBottom} = getWindowOffset();
  windowHeight -= windowTop;
  windowHeight -= windowBottom;
fxy060608's avatar
fxy060608 已提交
1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634
  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 已提交
1635 1636
  };
});
fxy060608's avatar
fxy060608 已提交
1637
const getSystemInfo = /* @__PURE__ */ createApi(() => {
fxy060608's avatar
fxy060608 已提交
1638 1639 1640 1641 1642
  return getSystemInfoSync();
});
const openDocument = /* @__PURE__ */ createApi((option) => {
  window.open(option.filePath);
}, OpenDocumentProtocol);
fxy060608's avatar
fxy060608 已提交
1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664
function _getServiceAddress() {
  return window.location.protocol + "//" + window.location.host;
}
const getImageInfo = /* @__PURE__ */ createApi(({src}, callbackId) => {
  const {invokeCallbackHandler: invoke} = UniServiceJSBridge;
  const img = new Image();
  const realPath = src;
  img.onload = function() {
    invoke(callbackId, {
      errMsg: "getImageInfo:ok",
      width: img.naturalWidth,
      height: img.naturalHeight,
      path: realPath.indexOf("/") === 0 ? _getServiceAddress() + realPath : realPath
    });
  };
  img.onerror = function() {
    invoke(callbackId, {
      errMsg: "getImageInfo:fail"
    });
  };
  img.src = src;
}, GetImageInfoProtocol, GetImageInfoOptions);
fxy060608's avatar
fxy060608 已提交
1665 1666
const navigateBack = /* @__PURE__ */ createApi(() => {
});
fxy060608's avatar
fxy060608 已提交
1667 1668 1669
const navigateTo = /* @__PURE__ */ createApi((options) => {
  const router = getApp().$router;
  router.push(options.url);
fxy060608's avatar
fxy060608 已提交
1670 1671 1672 1673 1674 1675 1676
});
const redirectTo = /* @__PURE__ */ createApi(() => {
});
const reLaunch = /* @__PURE__ */ createApi(() => {
});
const switchTab = /* @__PURE__ */ createApi(() => {
});
fxy060608's avatar
fxy060608 已提交
1677 1678 1679
const getRealPath = /* @__PURE__ */ createApi((path) => {
  return path;
});
fxy060608's avatar
fxy060608 已提交
1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693
var api = /* @__PURE__ */ Object.freeze({
  __proto__: null,
  upx2px,
  addInterceptor,
  removeInterceptor,
  promiseInterceptor,
  arrayBufferToBase64,
  base64ToArrayBuffer,
  createIntersectionObserver: createIntersectionObserver$1,
  canIUse,
  makePhoneCall,
  getSystemInfo,
  getSystemInfoSync,
  openDocument,
fxy060608's avatar
fxy060608 已提交
1694
  getImageInfo,
fxy060608's avatar
fxy060608 已提交
1695 1696 1697 1698
  navigateBack,
  navigateTo,
  redirectTo,
  reLaunch,
fxy060608's avatar
fxy060608 已提交
1699 1700
  switchTab,
  getRealPath
fxy060608's avatar
fxy060608 已提交
1701
});
fxy060608's avatar
fxy060608 已提交
1702
var script$4 = {
fxy060608's avatar
fxy060608 已提交
1703
  name: "App",
fxy060608's avatar
fxy060608 已提交
1704 1705 1706 1707 1708 1709
  components,
  mixins,
  props: {
    keepAliveInclude: {
      type: Array,
      default: function() {
fxy060608's avatar
fxy060608 已提交
1710
        return [];
fxy060608's avatar
fxy060608 已提交
1711 1712 1713 1714 1715
      }
    }
  },
  data() {
    return {
fxy060608's avatar
fxy060608 已提交
1716
      transitionName: "fade",
fxy060608's avatar
fxy060608 已提交
1717 1718 1719
      hideTabBar: false,
      tabBar: __uniConfig.tabBar || {},
      sysComponents: this.$sysComponents
fxy060608's avatar
fxy060608 已提交
1720
    };
fxy060608's avatar
fxy060608 已提交
1721 1722 1723
  },
  computed: {
    key() {
fxy060608's avatar
fxy060608 已提交
1724
      return this.$route.meta.name + "-" + this.$route.params.__id__ + "-" + (__uniConfig.reLaunch || 1);
fxy060608's avatar
fxy060608 已提交
1725 1726
    },
    hasTabBar() {
fxy060608's avatar
fxy060608 已提交
1727
      return __uniConfig.tabBar && __uniConfig.tabBar.list && __uniConfig.tabBar.list.length;
fxy060608's avatar
fxy060608 已提交
1728 1729
    },
    showTabBar() {
fxy060608's avatar
fxy060608 已提交
1730
      return this.$route.meta.isTabBar && !this.hideTabBar;
fxy060608's avatar
fxy060608 已提交
1731 1732 1733 1734
    }
  },
  watch: {
    $route(newRoute, oldRoute) {
fxy060608's avatar
fxy060608 已提交
1735
      UniServiceJSBridge.emit("onHidePopup");
fxy060608's avatar
fxy060608 已提交
1736 1737
    },
    hideTabBar(newVal, oldVal) {
fxy060608's avatar
fxy060608 已提交
1738 1739 1740 1741 1742 1743 1744 1745
      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 已提交
1746 1747 1748
    }
  },
  created() {
fxy060608's avatar
fxy060608 已提交
1749 1750
    if (canIUse("css.var")) {
      document.documentElement.style.setProperty("--status-bar-height", "0px");
fxy060608's avatar
fxy060608 已提交
1751 1752 1753
    }
  },
  mounted() {
fxy060608's avatar
fxy060608 已提交
1754 1755 1756 1757 1758 1759 1760 1761
    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 已提交
1762
      } else {
fxy060608's avatar
fxy060608 已提交
1763
        UniServiceJSBridge.emit("onAppEnterBackground");
fxy060608's avatar
fxy060608 已提交
1764
      }
fxy060608's avatar
fxy060608 已提交
1765
    });
fxy060608's avatar
fxy060608 已提交
1766
  }
fxy060608's avatar
fxy060608 已提交
1767
};
fxy060608's avatar
fxy060608 已提交
1768
function render$4(_ctx, _cache, $props, $setup, $data, $options) {
fxy060608's avatar
fxy060608 已提交
1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801
  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 已提交
1802
function initSystemComponents(app2) {
fxy060608's avatar
fxy060608 已提交
1803 1804
  script$4.name = COMPONENT_NAME_PREFIX + script$4.name;
  app2.component(script$4.name, script$4);
fxy060608's avatar
fxy060608 已提交
1805 1806 1807
}
var index = {
  install(app) {
fxy060608's avatar
fxy060608 已提交
1808 1809 1810 1811 1812 1813 1814
    initApp(app);
    initView(app);
    initService(app);
    initSystemComponents(app);
    initRouter(app);
  }
};
fxy060608's avatar
fxy060608 已提交
1815 1816 1817 1818 1819
const UniViewJSBridge$1 = extend(ViewJSBridge, {
  publishHandler(event, args, pageId) {
    window.UniServiceJSBridge.subscribeHandler(event, args, pageId);
  }
});
fxy060608's avatar
fxy060608 已提交
1820
const uni$1 = api;
fxy060608's avatar
fxy060608 已提交
1821 1822 1823 1824 1825
const UniServiceJSBridge$1 = extend(ServiceJSBridge, {
  publishHandler(event, args, pageId) {
    window.UniViewJSBridge.subscribeHandler(event, args, pageId);
  }
});
fxy060608's avatar
fxy060608 已提交
1826
let appVm;
fxy060608's avatar
fxy060608 已提交
1827
function getApp$1() {
fxy060608's avatar
fxy060608 已提交
1828
  return appVm;
fxy060608's avatar
fxy060608 已提交
1829 1830
}
function getCurrentPages$1() {
fxy060608's avatar
fxy060608 已提交
1831
  return [];
fxy060608's avatar
fxy060608 已提交
1832 1833 1834
}
function mergeTitleNView(navigationBar, titleNView) {
  if (isPlainObject(titleNView)) {
fxy060608's avatar
fxy060608 已提交
1835 1836
    if (hasOwn(titleNView, "backgroundColor")) {
      navigationBar.backgroundColor = titleNView.backgroundColor;
fxy060608's avatar
fxy060608 已提交
1837
    }
fxy060608's avatar
fxy060608 已提交
1838 1839
    if (hasOwn(titleNView, "buttons")) {
      navigationBar.buttons = titleNView.buttons;
fxy060608's avatar
fxy060608 已提交
1840
    }
fxy060608's avatar
fxy060608 已提交
1841 1842
    if (hasOwn(titleNView, "titleColor")) {
      navigationBar.textColor = titleNView.titleColor;
fxy060608's avatar
fxy060608 已提交
1843
    }
fxy060608's avatar
fxy060608 已提交
1844 1845
    if (hasOwn(titleNView, "titleText")) {
      navigationBar.titleText = titleNView.titleText;
fxy060608's avatar
fxy060608 已提交
1846
    }
fxy060608's avatar
fxy060608 已提交
1847 1848
    if (hasOwn(titleNView, "titleSize")) {
      navigationBar.titleSize = titleNView.titleSize;
fxy060608's avatar
fxy060608 已提交
1849
    }
fxy060608's avatar
fxy060608 已提交
1850 1851
    if (hasOwn(titleNView, "type")) {
      navigationBar.type = titleNView.type;
fxy060608's avatar
fxy060608 已提交
1852
    }
fxy060608's avatar
fxy060608 已提交
1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863
    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 已提交
1864 1865
    }
  }
fxy060608's avatar
fxy060608 已提交
1866
  return navigationBar;
fxy060608's avatar
fxy060608 已提交
1867 1868
}
function appendCss(css, cssId, replace = false) {
fxy060608's avatar
fxy060608 已提交
1869
  let style = document.getElementById(cssId);
fxy060608's avatar
fxy060608 已提交
1870
  if (style && replace) {
fxy060608's avatar
fxy060608 已提交
1871 1872
    style.parentNode.removeChild(style);
    style = null;
fxy060608's avatar
fxy060608 已提交
1873 1874
  }
  if (!style) {
fxy060608's avatar
fxy060608 已提交
1875 1876 1877 1878
    style = document.createElement("style");
    style.type = "text/css";
    cssId && (style.id = cssId);
    document.getElementsByTagName("head")[0].appendChild(style);
fxy060608's avatar
fxy060608 已提交
1879
  }
fxy060608's avatar
fxy060608 已提交
1880
  style.appendChild(document.createTextNode(css));
fxy060608's avatar
fxy060608 已提交
1881 1882
}
function hexToRgba(hex) {
fxy060608's avatar
fxy060608 已提交
1883 1884 1885 1886
  let r;
  let g;
  let b;
  hex = hex.replace("#", "");
fxy060608's avatar
fxy060608 已提交
1887
  if (hex.length === 6) {
fxy060608's avatar
fxy060608 已提交
1888 1889 1890
    r = hex.substring(0, 2);
    g = hex.substring(2, 4);
    b = hex.substring(4, 6);
fxy060608's avatar
fxy060608 已提交
1891
  } else if (hex.length === 3) {
fxy060608's avatar
fxy060608 已提交
1892 1893 1894
    r = hex.substring(0, 1);
    g = hex.substring(1, 2);
    b = hex.substring(2, 3);
fxy060608's avatar
fxy060608 已提交
1895
  } else {
fxy060608's avatar
fxy060608 已提交
1896
    return false;
fxy060608's avatar
fxy060608 已提交
1897 1898
  }
  if (r.length === 1) {
fxy060608's avatar
fxy060608 已提交
1899
    r += r;
fxy060608's avatar
fxy060608 已提交
1900 1901
  }
  if (g.length === 1) {
fxy060608's avatar
fxy060608 已提交
1902
    g += g;
fxy060608's avatar
fxy060608 已提交
1903 1904
  }
  if (b.length === 1) {
fxy060608's avatar
fxy060608 已提交
1905
    b += b;
fxy060608's avatar
fxy060608 已提交
1906
  }
fxy060608's avatar
fxy060608 已提交
1907 1908 1909
  r = parseInt(r, 16);
  g = parseInt(g, 16);
  b = parseInt(b, 16);
fxy060608's avatar
fxy060608 已提交
1910 1911 1912 1913
  return {
    r,
    g,
    b
fxy060608's avatar
fxy060608 已提交
1914
  };
fxy060608's avatar
fxy060608 已提交
1915 1916 1917
}
var transparent = {
  mounted() {
fxy060608's avatar
fxy060608 已提交
1918 1919 1920 1921 1922 1923
    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 已提交
1924
      for (let i = 0; i < iconElems.length; i++) {
fxy060608's avatar
fxy060608 已提交
1925
        iconElemsStyles.push(iconElems[i].style);
fxy060608's avatar
fxy060608 已提交
1926
      }
fxy060608's avatar
fxy060608 已提交
1927 1928 1929
      const borderRadiusElems = this.$el.querySelectorAll(".uni-page-head-btn");
      const oldColors = [];
      const borderRadiusElemsStyles = [];
fxy060608's avatar
fxy060608 已提交
1930
      for (let i = 0; i < borderRadiusElems.length; i++) {
fxy060608's avatar
fxy060608 已提交
1931 1932 1933
        const borderRadiusElem = borderRadiusElems[i];
        oldColors.push(getComputedStyle(borderRadiusElem).backgroundColor);
        borderRadiusElemsStyles.push(borderRadiusElem.style);
fxy060608's avatar
fxy060608 已提交
1934
      }
fxy060608's avatar
fxy060608 已提交
1935 1936 1937
      this._A = 0;
      UniViewJSBridge.on("onPageScroll", ({scrollTop}) => {
        const alpha = Math.min(scrollTop / this.offset, 1);
fxy060608's avatar
fxy060608 已提交
1938
        if (alpha === 1 && this._A === 1) {
fxy060608's avatar
fxy060608 已提交
1939
          return;
fxy060608's avatar
fxy060608 已提交
1940 1941 1942
        }
        if (alpha > 0.5 && this._A <= 0.5) {
          iconElemsStyles.forEach(function(iconElemStyle) {
fxy060608's avatar
fxy060608 已提交
1943 1944
            iconElemStyle.color = textColor;
          });
fxy060608's avatar
fxy060608 已提交
1945 1946
        } else if (alpha <= 0.5 && this._A > 0.5) {
          iconElemsStyles.forEach(function(iconElemStyle) {
fxy060608's avatar
fxy060608 已提交
1947 1948
            iconElemStyle.color = "#fff";
          });
fxy060608's avatar
fxy060608 已提交
1949
        }
fxy060608's avatar
fxy060608 已提交
1950
        this._A = alpha;
fxy060608's avatar
fxy060608 已提交
1951
        if (titleElem) {
fxy060608's avatar
fxy060608 已提交
1952
          titleElem.style.opacity = alpha;
fxy060608's avatar
fxy060608 已提交
1953
        }
fxy060608's avatar
fxy060608 已提交
1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964
        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 已提交
1965
      for (let i = 0; i < iconElems.length; i++) {
fxy060608's avatar
fxy060608 已提交
1966
        iconElemsStyles.push(iconElems[i].style);
fxy060608's avatar
fxy060608 已提交
1967
      }
fxy060608's avatar
fxy060608 已提交
1968 1969 1970
      const borderRadiusElems = this.$el.querySelectorAll(".uni-page-head-btn");
      const oldColors = [];
      const borderRadiusElemsStyles = [];
fxy060608's avatar
fxy060608 已提交
1971
      for (let i = 0; i < borderRadiusElems.length; i++) {
fxy060608's avatar
fxy060608 已提交
1972 1973 1974
        const borderRadiusElem = borderRadiusElems[i];
        oldColors.push(getComputedStyle(borderRadiusElem).backgroundColor);
        borderRadiusElemsStyles.push(borderRadiusElem.style);
fxy060608's avatar
fxy060608 已提交
1975 1976 1977 1978 1979
      }
    }
  },
  computed: {
    color() {
fxy060608's avatar
fxy060608 已提交
1980
      return this.type === "transparent" ? "#fff" : this.textColor;
fxy060608's avatar
fxy060608 已提交
1981 1982
    },
    offset() {
fxy060608's avatar
fxy060608 已提交
1983
      return parseInt(this.coverage);
fxy060608's avatar
fxy060608 已提交
1984 1985
    },
    bgColor() {
fxy060608's avatar
fxy060608 已提交
1986 1987 1988 1989 1990 1991
      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 已提交
1992
      }
fxy060608's avatar
fxy060608 已提交
1993
      return this.backgroundColor;
fxy060608's avatar
fxy060608 已提交
1994 1995
    }
  }
fxy060608's avatar
fxy060608 已提交
1996
};
fxy060608's avatar
fxy060608 已提交
1997
const FONTS = {
fxy060608's avatar
fxy060608 已提交
1998 1999 2000 2001 2002 2003 2004 2005
  forward: "&#xe600;",
  back: "&#xe601;",
  share: "&#xe602;",
  favorite: "&#xe604;",
  home: "&#xe605;",
  menu: "&#xe606;",
  close: "&#xe650;"
};
fxy060608's avatar
fxy060608 已提交
2006
var script$5 = {
fxy060608's avatar
fxy060608 已提交
2007
  name: "PageHead",
fxy060608's avatar
fxy060608 已提交
2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019
  mixins: [transparent],
  components: {
    VUniInput: Input
  },
  props: {
    backButton: {
      type: Boolean,
      default: true
    },
    backgroundColor: {
      type: String,
      default() {
fxy060608's avatar
fxy060608 已提交
2020
        return this.type === "transparent" ? "#000" : "#F8F8F8";
fxy060608's avatar
fxy060608 已提交
2021 2022 2023 2024
      }
    },
    textColor: {
      type: String,
fxy060608's avatar
fxy060608 已提交
2025
      default: "#fff"
fxy060608's avatar
fxy060608 已提交
2026 2027 2028
    },
    titleText: {
      type: String,
fxy060608's avatar
fxy060608 已提交
2029
      default: ""
fxy060608's avatar
fxy060608 已提交
2030 2031 2032
    },
    duration: {
      type: String,
fxy060608's avatar
fxy060608 已提交
2033
      default: "0"
fxy060608's avatar
fxy060608 已提交
2034 2035 2036
    },
    timingFunc: {
      type: String,
fxy060608's avatar
fxy060608 已提交
2037
      default: ""
fxy060608's avatar
fxy060608 已提交
2038 2039 2040 2041 2042 2043 2044
    },
    loading: {
      type: Boolean,
      default: false
    },
    titleSize: {
      type: String,
fxy060608's avatar
fxy060608 已提交
2045
      default: "16px"
fxy060608's avatar
fxy060608 已提交
2046 2047
    },
    type: {
fxy060608's avatar
fxy060608 已提交
2048
      default: "default",
fxy060608's avatar
fxy060608 已提交
2049
      validator(value) {
fxy060608's avatar
fxy060608 已提交
2050
        return ["default", "transparent", "float"].indexOf(value) !== -1;
fxy060608's avatar
fxy060608 已提交
2051 2052 2053 2054
      }
    },
    coverage: {
      type: String,
fxy060608's avatar
fxy060608 已提交
2055
      default: "132px"
fxy060608's avatar
fxy060608 已提交
2056 2057 2058 2059
    },
    buttons: {
      type: Array,
      default() {
fxy060608's avatar
fxy060608 已提交
2060
        return [];
fxy060608's avatar
fxy060608 已提交
2061 2062 2063 2064 2065
      }
    },
    searchInput: {
      type: [Object, Boolean],
      default() {
fxy060608's avatar
fxy060608 已提交
2066
        return false;
fxy060608's avatar
fxy060608 已提交
2067 2068 2069 2070
      }
    },
    titleImage: {
      type: String,
fxy060608's avatar
fxy060608 已提交
2071
      default: ""
fxy060608's avatar
fxy060608 已提交
2072 2073 2074 2075 2076 2077 2078 2079
    },
    titlePenetrate: {
      type: Boolean,
      default: false
    },
    shadow: {
      type: Object,
      default() {
fxy060608's avatar
fxy060608 已提交
2080
        return {};
fxy060608's avatar
fxy060608 已提交
2081 2082 2083 2084 2085 2086
      }
    }
  },
  data() {
    return {
      focus: false,
fxy060608's avatar
fxy060608 已提交
2087
      text: "",
fxy060608's avatar
fxy060608 已提交
2088
      composing: false
fxy060608's avatar
fxy060608 已提交
2089
    };
fxy060608's avatar
fxy060608 已提交
2090 2091 2092
  },
  computed: {
    btns() {
fxy060608's avatar
fxy060608 已提交
2093 2094
      const btns = [];
      const fonts = {};
fxy060608's avatar
fxy060608 已提交
2095
      if (this.buttons.length) {
fxy060608's avatar
fxy060608 已提交
2096 2097
        this.buttons.forEach((button) => {
          const btn = Object.assign({}, button);
fxy060608's avatar
fxy060608 已提交
2098
          if (btn.fontSrc && !btn.fontFamily) {
fxy060608's avatar
fxy060608 已提交
2099 2100
            const fontSrc = btn.fontSrc = this.$getRealPath(btn.fontSrc);
            let fontFamily;
fxy060608's avatar
fxy060608 已提交
2101
            if (fontSrc in fonts) {
fxy060608's avatar
fxy060608 已提交
2102
              fontFamily = fonts[fontSrc];
fxy060608's avatar
fxy060608 已提交
2103
            } else {
fxy060608's avatar
fxy060608 已提交
2104 2105 2106 2107
              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 已提交
2108
            }
fxy060608's avatar
fxy060608 已提交
2109
            btn.fontFamily = fontFamily;
fxy060608's avatar
fxy060608 已提交
2110
          }
fxy060608's avatar
fxy060608 已提交
2111 2112
          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 已提交
2113
          if (/\d$/.test(fontSize)) {
fxy060608's avatar
fxy060608 已提交
2114
            fontSize += "px";
fxy060608's avatar
fxy060608 已提交
2115
          }
fxy060608's avatar
fxy060608 已提交
2116 2117 2118 2119
          btn.fontSize = fontSize;
          btn.fontWeight = btn.fontWeight || "normal";
          btns.push(btn);
        });
fxy060608's avatar
fxy060608 已提交
2120
      }
fxy060608's avatar
fxy060608 已提交
2121
      return btns;
fxy060608's avatar
fxy060608 已提交
2122 2123
    },
    leftBtns() {
fxy060608's avatar
fxy060608 已提交
2124
      return this.btns.filter((btn) => btn.float === "left");
fxy060608's avatar
fxy060608 已提交
2125 2126
    },
    rightBtns() {
fxy060608's avatar
fxy060608 已提交
2127
      return this.btns.filter((btn) => btn.float !== "left");
fxy060608's avatar
fxy060608 已提交
2128 2129
    },
    headClass() {
fxy060608's avatar
fxy060608 已提交
2130
      const shadowColorType = this.shadow.colorType;
fxy060608's avatar
fxy060608 已提交
2131
      const data = {
fxy060608's avatar
fxy060608 已提交
2132 2133 2134 2135
        "uni-page-head-transparent": this.type === "transparent",
        "uni-page-head-titlePenetrate": this.titlePenetrate,
        "uni-page-head-shadow": shadowColorType
      };
fxy060608's avatar
fxy060608 已提交
2136
      if (shadowColorType) {
fxy060608's avatar
fxy060608 已提交
2137
        data[`uni-page-head-shadow-${shadowColorType}`] = shadowColorType;
fxy060608's avatar
fxy060608 已提交
2138
      }
fxy060608's avatar
fxy060608 已提交
2139
      return data;
fxy060608's avatar
fxy060608 已提交
2140 2141 2142 2143
    }
  },
  mounted() {
    if (this.searchInput) {
fxy060608's avatar
fxy060608 已提交
2144 2145 2146 2147
      const input = this.$refs.input;
      input.$watch("composing", (val) => {
        this.composing = val;
      });
fxy060608's avatar
fxy060608 已提交
2148
      if (this.searchInput.disabled) {
fxy060608's avatar
fxy060608 已提交
2149 2150 2151
        input.$el.addEventListener("click", () => {
          UniServiceJSBridge.emit("onNavigationBarSearchInputClicked", "");
        });
fxy060608's avatar
fxy060608 已提交
2152
      } else {
fxy060608's avatar
fxy060608 已提交
2153 2154 2155
        input.$refs.input.addEventListener("keyup", (event) => {
          if (event.key.toUpperCase() === "ENTER") {
            UniServiceJSBridge.emit("onNavigationBarSearchInputConfirmed", {
fxy060608's avatar
fxy060608 已提交
2156
              text: this.text
fxy060608's avatar
fxy060608 已提交
2157
            });
fxy060608's avatar
fxy060608 已提交
2158
          }
fxy060608's avatar
fxy060608 已提交
2159 2160 2161
        });
        input.$refs.input.addEventListener("focus", () => {
          UniServiceJSBridge.emit("onNavigationBarSearchInputFocusChanged", {
fxy060608's avatar
fxy060608 已提交
2162
            focus: true
fxy060608's avatar
fxy060608 已提交
2163 2164 2165 2166
          });
        });
        input.$refs.input.addEventListener("blur", () => {
          UniServiceJSBridge.emit("onNavigationBarSearchInputFocusChanged", {
fxy060608's avatar
fxy060608 已提交
2167
            focus: false
fxy060608's avatar
fxy060608 已提交
2168 2169
          });
        });
fxy060608's avatar
fxy060608 已提交
2170 2171 2172 2173 2174 2175 2176
      }
    }
  },
  methods: {
    _back() {
      if (getCurrentPages().length === 1) {
        uni.reLaunch({
fxy060608's avatar
fxy060608 已提交
2177 2178
          url: "/"
        });
fxy060608's avatar
fxy060608 已提交
2179 2180
      } else {
        uni.navigateBack({
fxy060608's avatar
fxy060608 已提交
2181 2182
          from: "backbutton"
        });
fxy060608's avatar
fxy060608 已提交
2183 2184 2185
      }
    },
    _onBtnClick(index2) {
fxy060608's avatar
fxy060608 已提交
2186 2187 2188
      UniServiceJSBridge.emit("onNavigationBarButtonTap", Object.assign({}, this.btns[index2], {
        index: index2
      }));
fxy060608's avatar
fxy060608 已提交
2189 2190 2191
    },
    _formatBtnFontText(btn) {
      if (btn.fontSrc && btn.fontFamily) {
fxy060608's avatar
fxy060608 已提交
2192
        return btn.text.replace("\\u", "&#x");
fxy060608's avatar
fxy060608 已提交
2193
      } else if (FONTS[btn.type]) {
fxy060608's avatar
fxy060608 已提交
2194
        return FONTS[btn.type];
fxy060608's avatar
fxy060608 已提交
2195
      }
fxy060608's avatar
fxy060608 已提交
2196
      return btn.text || "";
fxy060608's avatar
fxy060608 已提交
2197 2198 2199 2200 2201 2202
    },
    _formatBtnStyle(btn) {
      const style = {
        color: btn.color,
        fontSize: btn.fontSize,
        fontWeight: btn.fontWeight
fxy060608's avatar
fxy060608 已提交
2203
      };
fxy060608's avatar
fxy060608 已提交
2204
      if (btn.fontFamily) {
fxy060608's avatar
fxy060608 已提交
2205
        style.fontFamily = btn.fontFamily;
fxy060608's avatar
fxy060608 已提交
2206
      }
fxy060608's avatar
fxy060608 已提交
2207
      return style;
fxy060608's avatar
fxy060608 已提交
2208 2209
    },
    _focus() {
fxy060608's avatar
fxy060608 已提交
2210
      this.focus = true;
fxy060608's avatar
fxy060608 已提交
2211 2212
    },
    _blur() {
fxy060608's avatar
fxy060608 已提交
2213
      this.focus = false;
fxy060608's avatar
fxy060608 已提交
2214 2215
    },
    _input(text) {
fxy060608's avatar
fxy060608 已提交
2216
      UniServiceJSBridge.emit("onNavigationBarSearchInputChanged", {
fxy060608's avatar
fxy060608 已提交
2217
        text
fxy060608's avatar
fxy060608 已提交
2218
      });
fxy060608's avatar
fxy060608 已提交
2219 2220
    }
  }
fxy060608's avatar
fxy060608 已提交
2221 2222
};
const _hoisted_1$4 = {class: "uni-page-head-hd"};
fxy060608's avatar
fxy060608 已提交
2223 2224
const _hoisted_2$4 = {
  key: 0,
fxy060608's avatar
fxy060608 已提交
2225 2226
  class: "uni-page-head-bd"
};
fxy060608's avatar
fxy060608 已提交
2227 2228
const _hoisted_3$3 = {
  key: 0,
fxy060608's avatar
fxy060608 已提交
2229 2230 2231
  class: "uni-loading"
};
const _hoisted_4$2 = {class: "uni-page-head-ft"};
fxy060608's avatar
fxy060608 已提交
2232
function render$5(_ctx, _cache, $props, $setup, $data, $options) {
fxy060608's avatar
fxy060608 已提交
2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 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
  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 已提交
2334
var script$6 = {
fxy060608's avatar
fxy060608 已提交
2335 2336
  name: "PageBody"
};
fxy060608's avatar
fxy060608 已提交
2337
function render$6(_ctx, _cache, $props, $setup, $data, $options) {
fxy060608's avatar
fxy060608 已提交
2338 2339 2340
  return openBlock(), createBlock("uni-page-wrapper", null, [
    createVNode("uni-page-body", null, [
      renderSlot(_ctx.$slots, "default")
fxy060608's avatar
fxy060608 已提交
2341
    ])
fxy060608's avatar
fxy060608 已提交
2342
  ]);
fxy060608's avatar
fxy060608 已提交
2343
}
fxy060608's avatar
fxy060608 已提交
2344 2345 2346
;
script$6.render = render$6;
script$6.__file = "packages/uni-h5/src/framework/components/page/pageBody.vue";
fxy060608's avatar
fxy060608 已提交
2347
var script$7 = {
fxy060608's avatar
fxy060608 已提交
2348
  name: "PageRefresh",
fxy060608's avatar
fxy060608 已提交
2349 2350 2351
  props: {
    color: {
      type: String,
fxy060608's avatar
fxy060608 已提交
2352
      default: "#2BD009"
fxy060608's avatar
fxy060608 已提交
2353 2354 2355 2356 2357 2358
    },
    offset: {
      type: Number,
      default: 0
    }
  }
fxy060608's avatar
fxy060608 已提交
2359 2360 2361 2362 2363 2364 2365
};
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 已提交
2366
const _hoisted_4$3 = {
fxy060608's avatar
fxy060608 已提交
2367 2368 2369 2370 2371
  class: "uni-page-refresh__spinner",
  width: "24",
  height: "24",
  viewBox: "25 25 50 50"
};
fxy060608's avatar
fxy060608 已提交
2372
function render$7(_ctx, _cache, $props, $setup, $data, $options) {
fxy060608's avatar
fxy060608 已提交
2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407
  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 已提交
2408
function processDeltaY(evt, identifier, startY) {
fxy060608's avatar
fxy060608 已提交
2409
  const touch = Array.prototype.slice.call(evt.changedTouches).filter((touch2) => touch2.identifier === identifier)[0];
fxy060608's avatar
fxy060608 已提交
2410
  if (!touch) {
fxy060608's avatar
fxy060608 已提交
2411
    return false;
fxy060608's avatar
fxy060608 已提交
2412
  }
fxy060608's avatar
fxy060608 已提交
2413 2414
  evt.deltaY = touch.pageY - startY;
  return true;
fxy060608's avatar
fxy060608 已提交
2415
}
fxy060608's avatar
fxy060608 已提交
2416 2417 2418 2419 2420
const PULLING = "pulling";
const REACHED = "reached";
const ABORTING = "aborting";
const REFRESHING = "refreshing";
const RESTORING = "restoring";
fxy060608's avatar
fxy060608 已提交
2421 2422 2423
var pullToRefresh = {
  mounted() {
    if (this.enablePullDownRefresh) {
fxy060608's avatar
fxy060608 已提交
2424 2425 2426 2427 2428 2429 2430 2431 2432 2433
      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 已提交
2434
        }
fxy060608's avatar
fxy060608 已提交
2435 2436 2437 2438 2439 2440 2441 2442 2443 2444
      });
      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 已提交
2445
        }
fxy060608's avatar
fxy060608 已提交
2446
      });
fxy060608's avatar
fxy060608 已提交
2447 2448 2449 2450
    }
  },
  methods: {
    _touchstart(evt) {
fxy060608's avatar
fxy060608 已提交
2451 2452 2453
      const touch = evt.changedTouches[0];
      this.touchId = touch.identifier;
      this.startY = touch.pageY;
fxy060608's avatar
fxy060608 已提交
2454
      if ([ABORTING, REFRESHING, RESTORING].indexOf(this.state) >= 0) {
fxy060608's avatar
fxy060608 已提交
2455
        this.canRefresh = false;
fxy060608's avatar
fxy060608 已提交
2456
      } else {
fxy060608's avatar
fxy060608 已提交
2457
        this.canRefresh = true;
fxy060608's avatar
fxy060608 已提交
2458 2459 2460 2461
      }
    },
    _touchmove(evt) {
      if (!this.canRefresh) {
fxy060608's avatar
fxy060608 已提交
2462
        return;
fxy060608's avatar
fxy060608 已提交
2463 2464
      }
      if (!processDeltaY(evt, this.touchId, this.startY)) {
fxy060608's avatar
fxy060608 已提交
2465
        return;
fxy060608's avatar
fxy060608 已提交
2466
      }
fxy060608's avatar
fxy060608 已提交
2467 2468 2469 2470
      let {deltaY} = evt;
      if ((document.documentElement.scrollTop || document.body.scrollTop) !== 0) {
        this.touchId = null;
        return;
fxy060608's avatar
fxy060608 已提交
2471 2472
      }
      if (deltaY < 0 && !this.state) {
fxy060608's avatar
fxy060608 已提交
2473
        return;
fxy060608's avatar
fxy060608 已提交
2474
      }
fxy060608's avatar
fxy060608 已提交
2475
      evt.preventDefault();
fxy060608's avatar
fxy060608 已提交
2476
      if (this.distance == null) {
fxy060608's avatar
fxy060608 已提交
2477 2478 2479
        this.offset = deltaY;
        this.state = PULLING;
        this._addClass();
fxy060608's avatar
fxy060608 已提交
2480
      }
fxy060608's avatar
fxy060608 已提交
2481
      deltaY = deltaY - this.offset;
fxy060608's avatar
fxy060608 已提交
2482
      if (deltaY < 0) {
fxy060608's avatar
fxy060608 已提交
2483
        deltaY = 0;
fxy060608's avatar
fxy060608 已提交
2484
      }
fxy060608's avatar
fxy060608 已提交
2485 2486 2487
      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 已提交
2488
      if (reached || pulling) {
fxy060608's avatar
fxy060608 已提交
2489 2490 2491
        this._removeClass();
        this.state = this.state === REACHED ? PULLING : REACHED;
        this._addClass();
fxy060608's avatar
fxy060608 已提交
2492
      }
fxy060608's avatar
fxy060608 已提交
2493
      this._pulling(deltaY);
fxy060608's avatar
fxy060608 已提交
2494 2495 2496
    },
    _touchend(evt) {
      if (!processDeltaY(evt, this.touchId, this.startY)) {
fxy060608's avatar
fxy060608 已提交
2497
        return;
fxy060608's avatar
fxy060608 已提交
2498 2499
      }
      if (this.state === null) {
fxy060608's avatar
fxy060608 已提交
2500
        return;
fxy060608's avatar
fxy060608 已提交
2501 2502
      }
      if (this.state === PULLING) {
fxy060608's avatar
fxy060608 已提交
2503 2504 2505
        this._removeClass();
        this.state = ABORTING;
        this._addClass();
fxy060608's avatar
fxy060608 已提交
2506
        this._aborting(() => {
fxy060608's avatar
fxy060608 已提交
2507 2508 2509
          this._removeClass();
          this.state = this.distance = this.offset = null;
        });
fxy060608's avatar
fxy060608 已提交
2510
      } else if (this.state === REACHED) {
fxy060608's avatar
fxy060608 已提交
2511 2512 2513 2514
        this._removeClass();
        this.state = REFRESHING;
        this._addClass();
        this._refreshing();
fxy060608's avatar
fxy060608 已提交
2515 2516 2517 2518
      }
    },
    _toggleClass(type) {
      if (!this.state) {
fxy060608's avatar
fxy060608 已提交
2519
        return;
fxy060608's avatar
fxy060608 已提交
2520
      }
fxy060608's avatar
fxy060608 已提交
2521
      const elem = this.refreshContainerElem;
fxy060608's avatar
fxy060608 已提交
2522
      if (elem) {
fxy060608's avatar
fxy060608 已提交
2523
        elem.classList[type]("uni-page-refresh--" + this.state);
fxy060608's avatar
fxy060608 已提交
2524 2525 2526
      }
    },
    _addClass() {
fxy060608's avatar
fxy060608 已提交
2527
      this._toggleClass("add");
fxy060608's avatar
fxy060608 已提交
2528 2529
    },
    _removeClass() {
fxy060608's avatar
fxy060608 已提交
2530
      this._toggleClass("remove");
fxy060608's avatar
fxy060608 已提交
2531 2532
    },
    _pulling(deltaY) {
fxy060608's avatar
fxy060608 已提交
2533
      const elem = this.refreshControllerElem;
fxy060608's avatar
fxy060608 已提交
2534
      if (!elem) {
fxy060608's avatar
fxy060608 已提交
2535
        return;
fxy060608's avatar
fxy060608 已提交
2536
      }
fxy060608's avatar
fxy060608 已提交
2537 2538
      const style = elem.style;
      let rotate = deltaY / this.refreshOptions.range;
fxy060608's avatar
fxy060608 已提交
2539
      if (rotate > 1) {
fxy060608's avatar
fxy060608 已提交
2540
        rotate = 1;
fxy060608's avatar
fxy060608 已提交
2541
      } else {
fxy060608's avatar
fxy060608 已提交
2542
        rotate = rotate * rotate * rotate;
fxy060608's avatar
fxy060608 已提交
2543
      }
fxy060608's avatar
fxy060608 已提交
2544 2545 2546 2547 2548
      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 已提交
2549 2550
    },
    _aborting(callback) {
fxy060608's avatar
fxy060608 已提交
2551
      const elem = this.refreshControllerElem;
fxy060608's avatar
fxy060608 已提交
2552
      if (!elem) {
fxy060608's avatar
fxy060608 已提交
2553
        return;
fxy060608's avatar
fxy060608 已提交
2554
      }
fxy060608's avatar
fxy060608 已提交
2555
      const style = elem.style;
fxy060608's avatar
fxy060608 已提交
2556
      if (style.webkitTransform) {
fxy060608's avatar
fxy060608 已提交
2557 2558
        style.webkitTransition = "-webkit-transform 0.3s";
        style.webkitTransform = "translate3d(-50%, 0, 0)";
fxy060608's avatar
fxy060608 已提交
2559
        const abortTransitionEnd = function() {
fxy060608's avatar
fxy060608 已提交
2560 2561 2562 2563 2564 2565 2566
          timeout && clearTimeout(timeout);
          elem.removeEventListener("webkitTransitionEnd", abortTransitionEnd);
          style.webkitTransition = "";
          callback();
        };
        elem.addEventListener("webkitTransitionEnd", abortTransitionEnd);
        const timeout = setTimeout(abortTransitionEnd, 350);
fxy060608's avatar
fxy060608 已提交
2567
      } else {
fxy060608's avatar
fxy060608 已提交
2568
        callback();
fxy060608's avatar
fxy060608 已提交
2569 2570 2571
      }
    },
    _refreshing() {
fxy060608's avatar
fxy060608 已提交
2572
      const elem = this.refreshControllerElem;
fxy060608's avatar
fxy060608 已提交
2573
      if (!elem) {
fxy060608's avatar
fxy060608 已提交
2574 2575 2576 2577 2578 2579
        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 已提交
2580 2581
    },
    _restoring(callback) {
fxy060608's avatar
fxy060608 已提交
2582
      const elem = this.refreshControllerElem;
fxy060608's avatar
fxy060608 已提交
2583
      if (!elem) {
fxy060608's avatar
fxy060608 已提交
2584
        return;
fxy060608's avatar
fxy060608 已提交
2585
      }
fxy060608's avatar
fxy060608 已提交
2586 2587 2588
      const style = elem.style;
      style.webkitTransition = "-webkit-transform 0.3s";
      style.webkitTransform += " scale(0.01)";
fxy060608's avatar
fxy060608 已提交
2589
      const restoreTransitionEnd = function() {
fxy060608's avatar
fxy060608 已提交
2590 2591 2592 2593 2594 2595 2596 2597
        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 已提交
2598 2599
    }
  }
fxy060608's avatar
fxy060608 已提交
2600
};
fxy060608's avatar
fxy060608 已提交
2601
var script$8 = {
fxy060608's avatar
fxy060608 已提交
2602 2603
  name: "Page",
  mpType: "page",
fxy060608's avatar
fxy060608 已提交
2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628
  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 已提交
2629
      default: "#000"
fxy060608's avatar
fxy060608 已提交
2630 2631
    },
    navigationBarTextStyle: {
fxy060608's avatar
fxy060608 已提交
2632
      default: "white",
fxy060608's avatar
fxy060608 已提交
2633
      validator(value) {
fxy060608's avatar
fxy060608 已提交
2634
        return ["white", "black"].indexOf(value) !== -1;
fxy060608's avatar
fxy060608 已提交
2635 2636 2637 2638
      }
    },
    navigationBarTitleText: {
      type: String,
fxy060608's avatar
fxy060608 已提交
2639
      default: ""
fxy060608's avatar
fxy060608 已提交
2640 2641
    },
    navigationStyle: {
fxy060608's avatar
fxy060608 已提交
2642
      default: "default",
fxy060608's avatar
fxy060608 已提交
2643
      validator(value) {
fxy060608's avatar
fxy060608 已提交
2644
        return ["default", "custom"].indexOf(value) !== -1;
fxy060608's avatar
fxy060608 已提交
2645 2646 2647 2648
      }
    },
    backgroundColor: {
      type: String,
fxy060608's avatar
fxy060608 已提交
2649
      default: "#ffffff"
fxy060608's avatar
fxy060608 已提交
2650 2651
    },
    backgroundTextStyle: {
fxy060608's avatar
fxy060608 已提交
2652
      default: "dark",
fxy060608's avatar
fxy060608 已提交
2653
      validator(value) {
fxy060608's avatar
fxy060608 已提交
2654
        return ["dark", "light"].indexOf(value) !== -1;
fxy060608's avatar
fxy060608 已提交
2655 2656 2657 2658
      }
    },
    backgroundColorTop: {
      type: String,
fxy060608's avatar
fxy060608 已提交
2659
      default: "#fff"
fxy060608's avatar
fxy060608 已提交
2660 2661 2662
    },
    backgroundColorBottom: {
      type: String,
fxy060608's avatar
fxy060608 已提交
2663
      default: "#fff"
fxy060608's avatar
fxy060608 已提交
2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678
    },
    enablePullDownRefresh: {
      type: Boolean,
      default: false
    },
    onReachBottomDistance: {
      type: Number,
      default: 50
    },
    disableScroll: {
      type: Boolean,
      default: false
    },
    titleNView: {
      type: [Boolean, Object, String],
fxy060608's avatar
fxy060608 已提交
2679
      default: ""
fxy060608's avatar
fxy060608 已提交
2680 2681 2682 2683
    },
    pullToRefresh: {
      type: Object,
      default() {
fxy060608's avatar
fxy060608 已提交
2684
        return {};
fxy060608's avatar
fxy060608 已提交
2685 2686 2687 2688
      }
    },
    titleImage: {
      type: String,
fxy060608's avatar
fxy060608 已提交
2689
      default: ""
fxy060608's avatar
fxy060608 已提交
2690 2691 2692
    },
    transparentTitle: {
      type: String,
fxy060608's avatar
fxy060608 已提交
2693
      default: ""
fxy060608's avatar
fxy060608 已提交
2694 2695 2696
    },
    titlePenetrate: {
      type: String,
fxy060608's avatar
fxy060608 已提交
2697
      default: "NO"
fxy060608's avatar
fxy060608 已提交
2698 2699 2700 2701
    },
    navigationBarShadow: {
      type: Object,
      default() {
fxy060608's avatar
fxy060608 已提交
2702
        return {};
fxy060608's avatar
fxy060608 已提交
2703 2704 2705 2706 2707
      }
    }
  },
  data() {
    const titleNViewTypeList = {
fxy060608's avatar
fxy060608 已提交
2708 2709 2710 2711 2712 2713
      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 已提交
2714
      titleNView = {
fxy060608's avatar
fxy060608 已提交
2715 2716
        type: "none"
      };
fxy060608's avatar
fxy060608 已提交
2717
    } else {
fxy060608's avatar
fxy060608 已提交
2718 2719 2720 2721 2722 2723 2724
      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 已提交
2725 2726 2727 2728
    }
    const yesNoParseList = {
      YES: true,
      NO: false
fxy060608's avatar
fxy060608 已提交
2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756
    };
    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 已提交
2757 2758 2759
    return {
      navigationBar,
      refreshOptions
fxy060608's avatar
fxy060608 已提交
2760
    };
fxy060608's avatar
fxy060608 已提交
2761 2762
  },
  created() {
fxy060608's avatar
fxy060608 已提交
2763 2764 2765
    const navigationBar = this.navigationBar;
    document.title = navigationBar.titleText;
    UniServiceJSBridge.emit("onNavigationBarChange", navigationBar);
fxy060608's avatar
fxy060608 已提交
2766
  }
fxy060608's avatar
fxy060608 已提交
2767
};
fxy060608's avatar
fxy060608 已提交
2768
function render$8(_ctx, _cache, $props, $setup, $data, $options) {
fxy060608's avatar
fxy060608 已提交
2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803
  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 已提交
2804
var script$9 = {
fxy060608's avatar
fxy060608 已提交
2805
  name: "AsyncError",
fxy060608's avatar
fxy060608 已提交
2806 2807
  methods: {
    _onClick() {
fxy060608's avatar
fxy060608 已提交
2808
      window.location.reload();
fxy060608's avatar
fxy060608 已提交
2809 2810
    }
  }
fxy060608's avatar
fxy060608 已提交
2811
};
fxy060608's avatar
fxy060608 已提交
2812
function render$9(_ctx, _cache, $props, $setup, $data, $options) {
fxy060608's avatar
fxy060608 已提交
2813 2814 2815 2816 2817 2818 2819 2820
  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 已提交
2821
var script$a = {
fxy060608's avatar
fxy060608 已提交
2822 2823 2824 2825
  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 已提交
2826
function render$a(_ctx, _cache, $props, $setup, $data, $options) {
fxy060608's avatar
fxy060608 已提交
2827 2828 2829 2830 2831 2832 2833
  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 已提交
2834
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, 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};