uni-h5.esm.js 79.3 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 686
}
var UniServiceJSBridge$1 = extend(ServiceJSBridge, {
  publishHandler(event, args, pageId) {
fxy060608's avatar
fxy060608 已提交
687
    window.UniViewJSBridge.subscribeHandler(event, args, pageId);
fxy060608's avatar
fxy060608 已提交
688
  }
fxy060608's avatar
fxy060608 已提交
689
});
fxy060608's avatar
fxy060608 已提交
690 691
var UniViewJSBridge$1 = extend(ViewJSBridge, {
  publishHandler(event, args, pageId) {
fxy060608's avatar
fxy060608 已提交
692
    window.UniServiceJSBridge.subscribeHandler(event, args, pageId);
fxy060608's avatar
fxy060608 已提交
693
  }
fxy060608's avatar
fxy060608 已提交
694
});
fxy060608's avatar
fxy060608 已提交
695
function initBridge$1() {
fxy060608's avatar
fxy060608 已提交
696 697
  window.UniServiceJSBridge = UniServiceJSBridge$1;
  window.UniViewJSBridge = UniViewJSBridge$1;
fxy060608's avatar
fxy060608 已提交
698 699
}
function initRouter(app) {
fxy060608's avatar
fxy060608 已提交
700 701 702 703 704 705 706 707
  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 已提交
708
      }
fxy060608's avatar
fxy060608 已提交
709 710
    }
  }));
fxy060608's avatar
fxy060608 已提交
711 712
}
var script = {
fxy060608's avatar
fxy060608 已提交
713
  name: "TabBar",
fxy060608's avatar
fxy060608 已提交
714 715
  props: {
    position: {
fxy060608's avatar
fxy060608 已提交
716
      default: "bottom",
fxy060608's avatar
fxy060608 已提交
717
      validator(value) {
fxy060608's avatar
fxy060608 已提交
718
        return ["bottom", "top"].indexOf(value) !== -1;
fxy060608's avatar
fxy060608 已提交
719 720 721 722
      }
    },
    color: {
      type: String,
fxy060608's avatar
fxy060608 已提交
723
      default: "#999"
fxy060608's avatar
fxy060608 已提交
724 725 726
    },
    selectedColor: {
      type: String,
fxy060608's avatar
fxy060608 已提交
727
      default: "#007aff"
fxy060608's avatar
fxy060608 已提交
728 729 730
    },
    backgroundColor: {
      type: String,
fxy060608's avatar
fxy060608 已提交
731
      default: "#f7f7fa"
fxy060608's avatar
fxy060608 已提交
732 733
    },
    borderStyle: {
fxy060608's avatar
fxy060608 已提交
734
      default: "black",
fxy060608's avatar
fxy060608 已提交
735
      validator(value) {
fxy060608's avatar
fxy060608 已提交
736
        return ["black", "white"].indexOf(value) !== -1;
fxy060608's avatar
fxy060608 已提交
737 738 739 740 741
      }
    },
    list: {
      type: Array,
      default: function() {
fxy060608's avatar
fxy060608 已提交
742
        return [];
fxy060608's avatar
fxy060608 已提交
743 744 745 746 747
      }
    }
  },
  computed: {
    borderColor() {
fxy060608's avatar
fxy060608 已提交
748
      return this.borderStyle === "white" ? "rgba(255, 255, 255, 0.33)" : "rgba(0, 0, 0, 0.33)";
fxy060608's avatar
fxy060608 已提交
749 750 751 752 753
    }
  },
  watch: {
    $route(to, from) {
      if (to.meta.isTabBar) {
fxy060608's avatar
fxy060608 已提交
754
        this.__path__ = to.path;
fxy060608's avatar
fxy060608 已提交
755 756 757 758
      }
    }
  },
  beforeCreate() {
fxy060608's avatar
fxy060608 已提交
759
    this.__path__ = this.$route.path;
fxy060608's avatar
fxy060608 已提交
760 761 762
  },
  methods: {
    _getRealPath(filePath) {
fxy060608's avatar
fxy060608 已提交
763 764
      if (filePath.indexOf("/") !== 0) {
        filePath = "/" + filePath;
fxy060608's avatar
fxy060608 已提交
765
      }
fxy060608's avatar
fxy060608 已提交
766
      return this.$getRealPath(filePath);
fxy060608's avatar
fxy060608 已提交
767
    },
fxy060608's avatar
fxy060608 已提交
768 769 770 771 772
    _switchTab({
      text,
      pagePath
    }, index2) {
      let url = "/" + pagePath;
fxy060608's avatar
fxy060608 已提交
773
      if (url === __uniRoutes[0].alias) {
fxy060608's avatar
fxy060608 已提交
774
        url = "/";
fxy060608's avatar
fxy060608 已提交
775 776 777 778 779
      }
      const detail = {
        index: index2,
        text,
        pagePath
fxy060608's avatar
fxy060608 已提交
780
      };
fxy060608's avatar
fxy060608 已提交
781
      if (this.$route.path !== url) {
fxy060608's avatar
fxy060608 已提交
782
        this.__path__ = this.$route.path;
fxy060608's avatar
fxy060608 已提交
783
        uni.switchTab({
fxy060608's avatar
fxy060608 已提交
784
          from: "tabBar",
fxy060608's avatar
fxy060608 已提交
785 786
          url,
          detail
fxy060608's avatar
fxy060608 已提交
787
        });
fxy060608's avatar
fxy060608 已提交
788
      } else {
fxy060608's avatar
fxy060608 已提交
789
        UniServiceJSBridge.emit("onTabItemTap", detail);
fxy060608's avatar
fxy060608 已提交
790 791 792
      }
    }
  }
fxy060608's avatar
fxy060608 已提交
793 794 795
};
const _hoisted_1 = {class: "uni-tabbar__bd"};
const _hoisted_2 = /* @__PURE__ */ createVNode("div", {class: "uni-placeholder"}, null, -1);
fxy060608's avatar
fxy060608 已提交
796
function render(_ctx, _cache, $props, $setup, $data, $options) {
fxy060608's avatar
fxy060608 已提交
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 832 833 834 835 836 837 838 839 840 841 842 843 844 845
  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 已提交
846 847
var Transtion = {
  methods: {
fxy060608's avatar
fxy060608 已提交
848 849 850 851
    beforeTransition() {
    },
    afterTransition() {
    }
fxy060608's avatar
fxy060608 已提交
852
  }
fxy060608's avatar
fxy060608 已提交
853
};
fxy060608's avatar
fxy060608 已提交
854
var script$1 = {
fxy060608's avatar
fxy060608 已提交
855
  name: "Toast",
fxy060608's avatar
fxy060608 已提交
856 857 858 859
  mixins: [Transtion],
  props: {
    title: {
      type: String,
fxy060608's avatar
fxy060608 已提交
860
      default: ""
fxy060608's avatar
fxy060608 已提交
861 862
    },
    icon: {
fxy060608's avatar
fxy060608 已提交
863
      default: "success",
fxy060608's avatar
fxy060608 已提交
864
      validator(value) {
fxy060608's avatar
fxy060608 已提交
865
        return ["success", "loading", "none"].indexOf(value) !== -1;
fxy060608's avatar
fxy060608 已提交
866 867 868 869
      }
    },
    image: {
      type: String,
fxy060608's avatar
fxy060608 已提交
870
      default: ""
fxy060608's avatar
fxy060608 已提交
871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886
    },
    duration: {
      type: Number,
      default: 1500
    },
    mask: {
      type: Boolean,
      default: false
    },
    visible: {
      type: Boolean,
      default: false
    }
  },
  computed: {
    iconClass() {
fxy060608's avatar
fxy060608 已提交
887 888
      if (this.icon === "success") {
        return "uni-icon-success-no-circle";
fxy060608's avatar
fxy060608 已提交
889
      }
fxy060608's avatar
fxy060608 已提交
890 891
      if (this.icon === "loading") {
        return "uni-loading";
fxy060608's avatar
fxy060608 已提交
892
      }
fxy060608's avatar
fxy060608 已提交
893
      return "";
fxy060608's avatar
fxy060608 已提交
894 895 896 897
    }
  },
  beforeUpdate() {
    if (this.visible) {
fxy060608's avatar
fxy060608 已提交
898
      this.timeoutId && clearTimeout(this.timeoutId);
fxy060608's avatar
fxy060608 已提交
899
      this.timeoutId = setTimeout(() => {
fxy060608's avatar
fxy060608 已提交
900 901
        UniServiceJSBridge.emit("onHideToast");
      }, this.duration);
fxy060608's avatar
fxy060608 已提交
902 903
    }
  }
fxy060608's avatar
fxy060608 已提交
904
};
fxy060608's avatar
fxy060608 已提交
905 906
const _hoisted_1$1 = {
  key: 1,
fxy060608's avatar
fxy060608 已提交
907 908 909
  class: "uni-sample-toast"
};
const _hoisted_2$1 = {class: "uni-simple-toast__text"};
fxy060608's avatar
fxy060608 已提交
910 911
const _hoisted_3 = {
  key: 2,
fxy060608's avatar
fxy060608 已提交
912 913 914
  class: "uni-toast"
};
const _hoisted_4 = {class: "uni-toast__content"};
fxy060608's avatar
fxy060608 已提交
915
function render$1(_ctx, _cache, $props, $setup, $data, $options) {
fxy060608's avatar
fxy060608 已提交
916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949
  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 已提交
950
var script$2 = {
fxy060608's avatar
fxy060608 已提交
951
  name: "Modal",
fxy060608's avatar
fxy060608 已提交
952 953 954 955
  mixins: [Transtion],
  props: {
    title: {
      type: String,
fxy060608's avatar
fxy060608 已提交
956
      default: ""
fxy060608's avatar
fxy060608 已提交
957 958 959
    },
    content: {
      type: String,
fxy060608's avatar
fxy060608 已提交
960
      default: ""
fxy060608's avatar
fxy060608 已提交
961 962 963 964 965 966 967
    },
    showCancel: {
      type: Boolean,
      default: true
    },
    cancelText: {
      type: String,
fxy060608's avatar
fxy060608 已提交
968
      default: "取消"
fxy060608's avatar
fxy060608 已提交
969 970 971
    },
    cancelColor: {
      type: String,
fxy060608's avatar
fxy060608 已提交
972
      default: "#000000"
fxy060608's avatar
fxy060608 已提交
973 974 975
    },
    confirmText: {
      type: String,
fxy060608's avatar
fxy060608 已提交
976
      default: "确定"
fxy060608's avatar
fxy060608 已提交
977 978 979
    },
    confirmColor: {
      type: String,
fxy060608's avatar
fxy060608 已提交
980
      default: "#007aff"
fxy060608's avatar
fxy060608 已提交
981 982 983 984 985 986 987 988
    },
    visible: {
      type: Boolean,
      default: false
    }
  },
  methods: {
    _close(type) {
fxy060608's avatar
fxy060608 已提交
989
      this.$emit("close", type);
fxy060608's avatar
fxy060608 已提交
990 991
    }
  }
fxy060608's avatar
fxy060608 已提交
992 993 994
};
const _hoisted_1$2 = /* @__PURE__ */ createVNode("div", {class: "uni-mask"}, null, -1);
const _hoisted_2$2 = {class: "uni-modal"};
fxy060608's avatar
fxy060608 已提交
995 996
const _hoisted_3$1 = {
  key: 0,
fxy060608's avatar
fxy060608 已提交
997 998 999
  class: "uni-modal__hd"
};
const _hoisted_4$1 = {class: "uni-modal__ft"};
fxy060608's avatar
fxy060608 已提交
1000
function render$2(_ctx, _cache, $props, $setup, $data, $options) {
fxy060608's avatar
fxy060608 已提交
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 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044
  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 已提交
1045
var script$3 = {
fxy060608's avatar
fxy060608 已提交
1046
  name: "ActionSheet",
fxy060608's avatar
fxy060608 已提交
1047 1048 1049
  props: {
    title: {
      type: String,
fxy060608's avatar
fxy060608 已提交
1050
      default: ""
fxy060608's avatar
fxy060608 已提交
1051 1052 1053 1054
    },
    itemList: {
      type: Array,
      default() {
fxy060608's avatar
fxy060608 已提交
1055
        return [];
fxy060608's avatar
fxy060608 已提交
1056 1057 1058 1059
      }
    },
    itemColor: {
      type: String,
fxy060608's avatar
fxy060608 已提交
1060
      default: "#000000"
fxy060608's avatar
fxy060608 已提交
1061 1062 1063 1064 1065 1066 1067 1068
    },
    visible: {
      type: Boolean,
      default: false
    }
  },
  methods: {
    _close(tapIndex) {
fxy060608's avatar
fxy060608 已提交
1069
      this.$emit("close", tapIndex);
fxy060608's avatar
fxy060608 已提交
1070 1071
    }
  }
fxy060608's avatar
fxy060608 已提交
1072 1073
};
const _hoisted_1$3 = {class: "uni-actionsheet__menu"};
fxy060608's avatar
fxy060608 已提交
1074 1075
const _hoisted_2$3 = {
  key: 0,
fxy060608's avatar
fxy060608 已提交
1076 1077 1078
  class: "uni-actionsheet__title"
};
const _hoisted_3$2 = {class: "uni-actionsheet__action"};
fxy060608's avatar
fxy060608 已提交
1079
function render$3(_ctx, _cache, $props, $setup, $data, $options) {
fxy060608's avatar
fxy060608 已提交
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 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121
  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 已提交
1122 1123 1124 1125
var Components = {
  Toast: script$1,
  Modal: script$2,
  ActionSheet: script$3
fxy060608's avatar
fxy060608 已提交
1126
};
fxy060608's avatar
fxy060608 已提交
1127 1128 1129
var components = {
  TabBar: script,
  ...Components
fxy060608's avatar
fxy060608 已提交
1130
};
fxy060608's avatar
fxy060608 已提交
1131 1132 1133 1134 1135 1136
var ActionSheet = {
  data() {
    return {
      showActionSheet: {
        visible: false
      }
fxy060608's avatar
fxy060608 已提交
1137
    };
fxy060608's avatar
fxy060608 已提交
1138 1139
  },
  created() {
fxy060608's avatar
fxy060608 已提交
1140 1141 1142 1143 1144 1145 1146
    UniServiceJSBridge.on("onShowActionSheet", (args, callback) => {
      this.showActionSheet = args;
      this.onActionSheetCloseCallback = callback;
    });
    UniServiceJSBridge.on("onHidePopup", (args) => {
      this.showActionSheet.visible = false;
    });
fxy060608's avatar
fxy060608 已提交
1147 1148 1149
  },
  methods: {
    _onActionSheetClose(type) {
fxy060608's avatar
fxy060608 已提交
1150 1151
      this.showActionSheet.visible = false;
      isFunction(this.onActionSheetCloseCallback) && this.onActionSheetCloseCallback(type);
fxy060608's avatar
fxy060608 已提交
1152 1153
    }
  }
fxy060608's avatar
fxy060608 已提交
1154
};
fxy060608's avatar
fxy060608 已提交
1155 1156 1157 1158 1159 1160
var Modal = {
  data() {
    return {
      showModal: {
        visible: false
      }
fxy060608's avatar
fxy060608 已提交
1161
    };
fxy060608's avatar
fxy060608 已提交
1162 1163
  },
  created() {
fxy060608's avatar
fxy060608 已提交
1164 1165 1166 1167 1168 1169 1170
    UniServiceJSBridge.on("onShowModal", (args, callback) => {
      this.showModal = args;
      this.onModalCloseCallback = callback;
    });
    UniServiceJSBridge.on("onHidePopup", (args) => {
      this.showModal.visible = false;
    });
fxy060608's avatar
fxy060608 已提交
1171 1172 1173
  },
  methods: {
    _onModalClose(type) {
fxy060608's avatar
fxy060608 已提交
1174 1175
      this.showModal.visible = false;
      isFunction(this.onModalCloseCallback) && this.onModalCloseCallback(type);
fxy060608's avatar
fxy060608 已提交
1176 1177
    }
  }
fxy060608's avatar
fxy060608 已提交
1178
};
fxy060608's avatar
fxy060608 已提交
1179 1180 1181 1182 1183 1184
var Toast = {
  data() {
    return {
      showToast: {
        visible: false
      }
fxy060608's avatar
fxy060608 已提交
1185
    };
fxy060608's avatar
fxy060608 已提交
1186 1187
  },
  created() {
fxy060608's avatar
fxy060608 已提交
1188 1189 1190 1191
    let showType = "";
    const createOnShow = (type) => {
      return (args) => {
        showType = type;
fxy060608's avatar
fxy060608 已提交
1192
        setTimeout(() => {
fxy060608's avatar
fxy060608 已提交
1193 1194 1195 1196 1197 1198 1199
          this.showToast = args;
        }, 10);
      };
    };
    UniServiceJSBridge.on("onShowToast", createOnShow("onShowToast"));
    UniServiceJSBridge.on("onShowLoading", createOnShow("onShowLoading"));
    const createOnHide = (type) => {
fxy060608's avatar
fxy060608 已提交
1200 1201
      return () => {
        if (!showType) {
fxy060608's avatar
fxy060608 已提交
1202
          return;
fxy060608's avatar
fxy060608 已提交
1203
        }
fxy060608's avatar
fxy060608 已提交
1204 1205 1206 1207 1208
        let warnMsg = "";
        if (type === "onHideToast" && showType !== "onShowToast") {
          warnMsg = "请注意 showToast 与 hideToast 必须配对使用";
        } else if (type === "onHideLoading" && showType !== "onShowLoading") {
          warnMsg = "请注意 showLoading 与 hideLoading 必须配对使用";
fxy060608's avatar
fxy060608 已提交
1209 1210
        }
        if (warnMsg) {
fxy060608's avatar
fxy060608 已提交
1211
          return console.warn(warnMsg);
fxy060608's avatar
fxy060608 已提交
1212
        }
fxy060608's avatar
fxy060608 已提交
1213
        showType = "";
fxy060608's avatar
fxy060608 已提交
1214
        setTimeout(() => {
fxy060608's avatar
fxy060608 已提交
1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226
          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 已提交
1227
for (var i = 0; i < chars.length; i++) {
fxy060608's avatar
fxy060608 已提交
1228
  lookup[chars.charCodeAt(i)] = i;
fxy060608's avatar
fxy060608 已提交
1229 1230
}
var encode = function(arraybuffer) {
fxy060608's avatar
fxy060608 已提交
1231
  var bytes = new Uint8Array(arraybuffer), i, len = bytes.length, base64 = "";
fxy060608's avatar
fxy060608 已提交
1232
  for (i = 0; i < len; i += 3) {
fxy060608's avatar
fxy060608 已提交
1233 1234 1235 1236
    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 已提交
1237 1238
  }
  if (len % 3 === 2) {
fxy060608's avatar
fxy060608 已提交
1239
    base64 = base64.substring(0, base64.length - 1) + "=";
fxy060608's avatar
fxy060608 已提交
1240
  } else if (len % 3 === 1) {
fxy060608's avatar
fxy060608 已提交
1241
    base64 = base64.substring(0, base64.length - 2) + "==";
fxy060608's avatar
fxy060608 已提交
1242
  }
fxy060608's avatar
fxy060608 已提交
1243 1244
  return base64;
};
fxy060608's avatar
fxy060608 已提交
1245
var decode = function(base64) {
fxy060608's avatar
fxy060608 已提交
1246 1247 1248 1249 1250 1251
  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 已提交
1252
  }
fxy060608's avatar
fxy060608 已提交
1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264
  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 已提交
1265
function createApi(fn, validate) {
fxy060608's avatar
fxy060608 已提交
1266 1267 1268
  if (process.env.NODE_ENV !== "production" && validate)
    ;
  return fn;
fxy060608's avatar
fxy060608 已提交
1269 1270 1271
}
const Base64ToArrayBufferProtocol = [
  {
fxy060608's avatar
fxy060608 已提交
1272
    name: "base64",
fxy060608's avatar
fxy060608 已提交
1273 1274 1275
    type: String,
    required: true
  }
fxy060608's avatar
fxy060608 已提交
1276
];
fxy060608's avatar
fxy060608 已提交
1277 1278
const ArrayBufferToBase64Protocol = [
  {
fxy060608's avatar
fxy060608 已提交
1279
    name: "arrayBuffer",
fxy060608's avatar
fxy060608 已提交
1280 1281 1282
    type: [ArrayBuffer, Uint8Array],
    required: true
  }
fxy060608's avatar
fxy060608 已提交
1283 1284 1285 1286 1287 1288 1289
];
const base64ToArrayBuffer = /* @__PURE__ */ createApi((base642) => {
  return decode(base642);
}, Base64ToArrayBufferProtocol);
const arrayBufferToBase64 = /* @__PURE__ */ createApi((arrayBuffer) => {
  return encode(arrayBuffer);
}, ArrayBufferToBase64Protocol);
fxy060608's avatar
fxy060608 已提交
1290 1291
const Upx2pxProtocol = [
  {
fxy060608's avatar
fxy060608 已提交
1292
    name: "upx",
fxy060608's avatar
fxy060608 已提交
1293 1294 1295
    type: [Number, String],
    required: true
  }
fxy060608's avatar
fxy060608 已提交
1296 1297 1298 1299 1300 1301
];
const EPS = 1e-4;
const BASE_DEVICE_WIDTH = 750;
let isIOS = false;
let deviceWidth = 0;
let deviceDPR = 0;
fxy060608's avatar
fxy060608 已提交
1302
function checkDeviceWidth() {
fxy060608's avatar
fxy060608 已提交
1303 1304 1305 1306
  const {platform, pixelRatio, windowWidth} = __GLOBAL__.getSystemInfoSync();
  deviceWidth = windowWidth;
  deviceDPR = pixelRatio;
  isIOS = platform === "ios";
fxy060608's avatar
fxy060608 已提交
1307 1308 1309
}
const upx2px = /* @__PURE__ */ createApi((number, newDeviceWidth) => {
  if (deviceWidth === 0) {
fxy060608's avatar
fxy060608 已提交
1310
    checkDeviceWidth();
fxy060608's avatar
fxy060608 已提交
1311
  }
fxy060608's avatar
fxy060608 已提交
1312
  number = Number(number);
fxy060608's avatar
fxy060608 已提交
1313
  if (number === 0) {
fxy060608's avatar
fxy060608 已提交
1314
    return 0;
fxy060608's avatar
fxy060608 已提交
1315
  }
fxy060608's avatar
fxy060608 已提交
1316
  let result = number / BASE_DEVICE_WIDTH * (newDeviceWidth || deviceWidth);
fxy060608's avatar
fxy060608 已提交
1317
  if (result < 0) {
fxy060608's avatar
fxy060608 已提交
1318
    result = -result;
fxy060608's avatar
fxy060608 已提交
1319
  }
fxy060608's avatar
fxy060608 已提交
1320
  result = Math.floor(result + EPS);
fxy060608's avatar
fxy060608 已提交
1321 1322
  if (result === 0) {
    if (deviceDPR === 1 || !isIOS) {
fxy060608's avatar
fxy060608 已提交
1323
      result = 1;
fxy060608's avatar
fxy060608 已提交
1324
    } else {
fxy060608's avatar
fxy060608 已提交
1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339
      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 已提交
1340 1341
const AddInterceptorProtocol = [
  {
fxy060608's avatar
fxy060608 已提交
1342
    name: "method",
fxy060608's avatar
fxy060608 已提交
1343 1344 1345
    type: [String, Object],
    required: true
  }
fxy060608's avatar
fxy060608 已提交
1346 1347
];
const RemoveInterceptorProtocol = AddInterceptorProtocol;
fxy060608's avatar
fxy060608 已提交
1348
function mergeInterceptorHook(interceptors, interceptor3) {
fxy060608's avatar
fxy060608 已提交
1349
  Object.keys(interceptor3).forEach((hook) => {
fxy060608's avatar
fxy060608 已提交
1350
    if (isFunction(interceptor3[hook])) {
fxy060608's avatar
fxy060608 已提交
1351
      interceptors[hook] = mergeHook(interceptors[hook], interceptor3[hook]);
fxy060608's avatar
fxy060608 已提交
1352
    }
fxy060608's avatar
fxy060608 已提交
1353
  });
fxy060608's avatar
fxy060608 已提交
1354 1355 1356
}
function removeInterceptorHook(interceptors, interceptor3) {
  if (!interceptors || !interceptor3) {
fxy060608's avatar
fxy060608 已提交
1357
    return;
fxy060608's avatar
fxy060608 已提交
1358
  }
fxy060608's avatar
fxy060608 已提交
1359
  Object.keys(interceptor3).forEach((hook) => {
fxy060608's avatar
fxy060608 已提交
1360
    if (isFunction(interceptor3[hook])) {
fxy060608's avatar
fxy060608 已提交
1361
      removeHook(interceptors[hook], interceptor3[hook]);
fxy060608's avatar
fxy060608 已提交
1362
    }
fxy060608's avatar
fxy060608 已提交
1363
  });
fxy060608's avatar
fxy060608 已提交
1364 1365
}
function mergeHook(parentVal, childVal) {
fxy060608's avatar
fxy060608 已提交
1366 1367
  const res = childVal ? parentVal ? parentVal.concat(childVal) : isArray(childVal) ? childVal : [childVal] : parentVal;
  return res ? dedupeHooks(res) : res;
fxy060608's avatar
fxy060608 已提交
1368 1369
}
function dedupeHooks(hooks) {
fxy060608's avatar
fxy060608 已提交
1370
  const res = [];
fxy060608's avatar
fxy060608 已提交
1371 1372
  for (let i = 0; i < hooks.length; i++) {
    if (res.indexOf(hooks[i]) === -1) {
fxy060608's avatar
fxy060608 已提交
1373
      res.push(hooks[i]);
fxy060608's avatar
fxy060608 已提交
1374 1375
    }
  }
fxy060608's avatar
fxy060608 已提交
1376
  return res;
fxy060608's avatar
fxy060608 已提交
1377 1378 1379
}
function removeHook(hooks, hook) {
  if (!hooks) {
fxy060608's avatar
fxy060608 已提交
1380
    return;
fxy060608's avatar
fxy060608 已提交
1381
  }
fxy060608's avatar
fxy060608 已提交
1382
  const index2 = hooks.indexOf(hook);
fxy060608's avatar
fxy060608 已提交
1383
  if (index2 !== -1) {
fxy060608's avatar
fxy060608 已提交
1384
    hooks.splice(index2, 1);
fxy060608's avatar
fxy060608 已提交
1385 1386 1387
  }
}
const addInterceptor = /* @__PURE__ */ createApi((method, interceptor3) => {
fxy060608's avatar
fxy060608 已提交
1388 1389
  if (typeof method === "string" && isPlainObject(interceptor3)) {
    mergeInterceptorHook(scopedInterceptors[method] || (scopedInterceptors[method] = {}), interceptor3);
fxy060608's avatar
fxy060608 已提交
1390
  } else if (isPlainObject(method)) {
fxy060608's avatar
fxy060608 已提交
1391
    mergeInterceptorHook(globalInterceptors, method);
fxy060608's avatar
fxy060608 已提交
1392
  }
fxy060608's avatar
fxy060608 已提交
1393
}, AddInterceptorProtocol);
fxy060608's avatar
fxy060608 已提交
1394
const removeInterceptor = /* @__PURE__ */ createApi((method, interceptor3) => {
fxy060608's avatar
fxy060608 已提交
1395
  if (typeof method === "string") {
fxy060608's avatar
fxy060608 已提交
1396
    if (isPlainObject(interceptor3)) {
fxy060608's avatar
fxy060608 已提交
1397
      removeInterceptorHook(scopedInterceptors[method], interceptor3);
fxy060608's avatar
fxy060608 已提交
1398
    } else {
fxy060608's avatar
fxy060608 已提交
1399
      delete scopedInterceptors[method];
fxy060608's avatar
fxy060608 已提交
1400 1401
    }
  } else if (isPlainObject(method)) {
fxy060608's avatar
fxy060608 已提交
1402
    removeInterceptorHook(globalInterceptors, method);
fxy060608's avatar
fxy060608 已提交
1403
  }
fxy060608's avatar
fxy060608 已提交
1404
}, RemoveInterceptorProtocol);
fxy060608's avatar
fxy060608 已提交
1405 1406 1407
const promiseInterceptor = {
  returnValue(res) {
    if (!isPromise(res)) {
fxy060608's avatar
fxy060608 已提交
1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420
      return res;
    }
    return res.then((res2) => {
      return res2[1];
    }).catch((res2) => {
      return res2[0];
    });
  }
};
const createIntersectionObserver$1 = /* @__PURE__ */ createApi(() => {
});
const createSelectorQuery$1 = /* @__PURE__ */ createApi(() => {
});
fxy060608's avatar
fxy060608 已提交
1421 1422
const CanIUseProtocol = [
  {
fxy060608's avatar
fxy060608 已提交
1423
    name: "schema",
fxy060608's avatar
fxy060608 已提交
1424 1425 1426
    type: String,
    required: true
  }
fxy060608's avatar
fxy060608 已提交
1427
];
fxy060608's avatar
fxy060608 已提交
1428 1429 1430 1431 1432 1433
const MakePhoneCallProtocol = {
  phoneNumber: {
    type: String,
    required: true,
    validator(phoneNumber) {
      if (!phoneNumber) {
fxy060608's avatar
fxy060608 已提交
1434
        return "makePhoneCall:fail parameter error: parameter.phoneNumber should not be empty String;";
fxy060608's avatar
fxy060608 已提交
1435 1436 1437
      }
    }
  }
fxy060608's avatar
fxy060608 已提交
1438
};
fxy060608's avatar
fxy060608 已提交
1439 1440 1441 1442 1443 1444 1445 1446
const OpenDocumentProtocol = {
  filePath: {
    type: String,
    required: true
  },
  fileType: {
    type: String
  }
fxy060608's avatar
fxy060608 已提交
1447
};
fxy060608's avatar
fxy060608 已提交
1448
function cssSupports(css) {
fxy060608's avatar
fxy060608 已提交
1449
  return window.CSS && window.CSS.supports && window.CSS.supports(css);
fxy060608's avatar
fxy060608 已提交
1450 1451
}
const SCHEMA_CSS = {
fxy060608's avatar
fxy060608 已提交
1452 1453 1454 1455 1456
  "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 已提交
1457
  if (hasOwn(SCHEMA_CSS, schema)) {
fxy060608's avatar
fxy060608 已提交
1458
    return SCHEMA_CSS[schema];
fxy060608's avatar
fxy060608 已提交
1459
  }
fxy060608's avatar
fxy060608 已提交
1460 1461 1462 1463
  return true;
}, CanIUseProtocol);
const makePhoneCall = /* @__PURE__ */ createApi(({phoneNumber}) => {
  window.location.href = `tel:${phoneNumber}`;
fxy060608's avatar
fxy060608 已提交
1464
  return {
fxy060608's avatar
fxy060608 已提交
1465 1466 1467 1468 1469 1470
    errMsg: "makePhoneCall:ok"
  };
}, MakePhoneCallProtocol);
const ua = navigator.userAgent;
const isAndroid = /android/i.test(ua);
const isIOS$1 = /iphone|ipad|ipod/i.test(ua);
fxy060608's avatar
fxy060608 已提交
1471
const getSystemInfoSync = /* @__PURE__ */ createApi(() => {
fxy060608's avatar
fxy060608 已提交
1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484
  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 已提交
1485
  if (isIOS$1) {
fxy060608's avatar
fxy060608 已提交
1486 1487
    osname = "iOS";
    const osversionFind = ua.match(/OS\s([\w_]+)\slike/);
fxy060608's avatar
fxy060608 已提交
1488
    if (osversionFind) {
fxy060608's avatar
fxy060608 已提交
1489
      osversion = osversionFind[1].replace(/_/g, ".");
fxy060608's avatar
fxy060608 已提交
1490
    }
fxy060608's avatar
fxy060608 已提交
1491
    const modelFind = ua.match(/\(([a-zA-Z]+);/);
fxy060608's avatar
fxy060608 已提交
1492
    if (modelFind) {
fxy060608's avatar
fxy060608 已提交
1493
      model = modelFind[1];
fxy060608's avatar
fxy060608 已提交
1494 1495
    }
  } else if (isAndroid) {
fxy060608's avatar
fxy060608 已提交
1496 1497
    osname = "Android";
    const osversionFind = ua.match(/Android[\s/]([\w\.]+)[;\s]/);
fxy060608's avatar
fxy060608 已提交
1498
    if (osversionFind) {
fxy060608's avatar
fxy060608 已提交
1499
      osversion = osversionFind[1];
fxy060608's avatar
fxy060608 已提交
1500
    }
fxy060608's avatar
fxy060608 已提交
1501 1502
    const infoFind = ua.match(/\((.+?)\)/);
    const infos = infoFind ? infoFind[1].split(";") : ua.split(" ");
fxy060608's avatar
fxy060608 已提交
1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513
    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 已提交
1514
    ];
fxy060608's avatar
fxy060608 已提交
1515
    for (let i = 0; i < infos.length; i++) {
fxy060608's avatar
fxy060608 已提交
1516 1517 1518 1519
      const info = infos[i];
      if (info.indexOf("Build") > 0) {
        model = info.split("Build")[0].trim();
        break;
fxy060608's avatar
fxy060608 已提交
1520
      }
fxy060608's avatar
fxy060608 已提交
1521
      let other;
fxy060608's avatar
fxy060608 已提交
1522 1523
      for (let o = 0; o < otherInfo.length; o++) {
        if (otherInfo[o].test(info)) {
fxy060608's avatar
fxy060608 已提交
1524 1525
          other = true;
          break;
fxy060608's avatar
fxy060608 已提交
1526 1527 1528
        }
      }
      if (!other) {
fxy060608's avatar
fxy060608 已提交
1529 1530
        model = info.trim();
        break;
fxy060608's avatar
fxy060608 已提交
1531 1532 1533
      }
    }
  } else {
fxy060608's avatar
fxy060608 已提交
1534 1535
    osname = "Other";
    osversion = "0";
fxy060608's avatar
fxy060608 已提交
1536
  }
fxy060608's avatar
fxy060608 已提交
1537 1538
  var system = `${osname} ${osversion}`;
  var platform = osname.toLocaleLowerCase();
fxy060608's avatar
fxy060608 已提交
1539 1540 1541 1542 1543 1544 1545
  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 已提交
1546 1547 1548 1549
  };
  const {top: windowTop, bottom: windowBottom} = getWindowOffset();
  windowHeight -= windowTop;
  windowHeight -= windowBottom;
fxy060608's avatar
fxy060608 已提交
1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569
  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 已提交
1570 1571
  };
});
fxy060608's avatar
fxy060608 已提交
1572
const getSystemInfo = /* @__PURE__ */ createApi(() => {
fxy060608's avatar
fxy060608 已提交
1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588
  return getSystemInfoSync();
});
const openDocument = /* @__PURE__ */ createApi((option) => {
  window.open(option.filePath);
  return true;
}, OpenDocumentProtocol);
const navigateBack = /* @__PURE__ */ createApi(() => {
});
const navigateTo = /* @__PURE__ */ createApi(() => {
});
const redirectTo = /* @__PURE__ */ createApi(() => {
});
const reLaunch = /* @__PURE__ */ createApi(() => {
});
const switchTab = /* @__PURE__ */ createApi(() => {
});
fxy060608's avatar
fxy060608 已提交
1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608
var api = /* @__PURE__ */ Object.freeze({
  __proto__: null,
  upx2px,
  addInterceptor,
  removeInterceptor,
  promiseInterceptor,
  arrayBufferToBase64,
  base64ToArrayBuffer,
  createSelectorQuery: createSelectorQuery$1,
  createIntersectionObserver: createIntersectionObserver$1,
  canIUse,
  makePhoneCall,
  getSystemInfo,
  getSystemInfoSync,
  openDocument,
  navigateBack,
  navigateTo,
  redirectTo,
  reLaunch,
  switchTab
fxy060608's avatar
fxy060608 已提交
1609
});
fxy060608's avatar
fxy060608 已提交
1610
var script$4 = {
fxy060608's avatar
fxy060608 已提交
1611
  name: "App",
fxy060608's avatar
fxy060608 已提交
1612 1613 1614 1615 1616 1617
  components,
  mixins,
  props: {
    keepAliveInclude: {
      type: Array,
      default: function() {
fxy060608's avatar
fxy060608 已提交
1618
        return [];
fxy060608's avatar
fxy060608 已提交
1619 1620 1621 1622 1623
      }
    }
  },
  data() {
    return {
fxy060608's avatar
fxy060608 已提交
1624
      transitionName: "fade",
fxy060608's avatar
fxy060608 已提交
1625 1626 1627
      hideTabBar: false,
      tabBar: __uniConfig.tabBar || {},
      sysComponents: this.$sysComponents
fxy060608's avatar
fxy060608 已提交
1628
    };
fxy060608's avatar
fxy060608 已提交
1629 1630 1631
  },
  computed: {
    key() {
fxy060608's avatar
fxy060608 已提交
1632
      return this.$route.meta.name + "-" + this.$route.params.__id__ + "-" + (__uniConfig.reLaunch || 1);
fxy060608's avatar
fxy060608 已提交
1633 1634
    },
    hasTabBar() {
fxy060608's avatar
fxy060608 已提交
1635
      return __uniConfig.tabBar && __uniConfig.tabBar.list && __uniConfig.tabBar.list.length;
fxy060608's avatar
fxy060608 已提交
1636 1637
    },
    showTabBar() {
fxy060608's avatar
fxy060608 已提交
1638
      return this.$route.meta.isTabBar && !this.hideTabBar;
fxy060608's avatar
fxy060608 已提交
1639 1640 1641 1642
    }
  },
  watch: {
    $route(newRoute, oldRoute) {
fxy060608's avatar
fxy060608 已提交
1643
      UniServiceJSBridge.emit("onHidePopup");
fxy060608's avatar
fxy060608 已提交
1644 1645
    },
    hideTabBar(newVal, oldVal) {
fxy060608's avatar
fxy060608 已提交
1646 1647 1648 1649 1650 1651 1652 1653
      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 已提交
1654 1655 1656
    }
  },
  created() {
fxy060608's avatar
fxy060608 已提交
1657 1658
    if (canIUse("css.var")) {
      document.documentElement.style.setProperty("--status-bar-height", "0px");
fxy060608's avatar
fxy060608 已提交
1659 1660 1661
    }
  },
  mounted() {
fxy060608's avatar
fxy060608 已提交
1662 1663 1664 1665 1666 1667 1668 1669
    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 已提交
1670
      } else {
fxy060608's avatar
fxy060608 已提交
1671
        UniServiceJSBridge.emit("onAppEnterBackground");
fxy060608's avatar
fxy060608 已提交
1672
      }
fxy060608's avatar
fxy060608 已提交
1673
    });
fxy060608's avatar
fxy060608 已提交
1674
  }
fxy060608's avatar
fxy060608 已提交
1675
};
fxy060608's avatar
fxy060608 已提交
1676
function render$4(_ctx, _cache, $props, $setup, $data, $options) {
fxy060608's avatar
fxy060608 已提交
1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709
  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 已提交
1710
function initSystemComponents(app2) {
fxy060608's avatar
fxy060608 已提交
1711 1712
  script$4.name = COMPONENT_NAME_PREFIX + script$4.name;
  app2.component(script$4.name, script$4);
fxy060608's avatar
fxy060608 已提交
1713 1714 1715
}
var index = {
  install(app) {
fxy060608's avatar
fxy060608 已提交
1716 1717 1718 1719 1720 1721 1722 1723 1724 1725
    initBridge$1();
    initApp(app);
    initView(app);
    initService(app);
    initSystemComponents(app);
    initRouter(app);
  }
};
const uni$1 = api;
let appVm;
fxy060608's avatar
fxy060608 已提交
1726
function getApp() {
fxy060608's avatar
fxy060608 已提交
1727
  return appVm;
fxy060608's avatar
fxy060608 已提交
1728 1729
}
function getCurrentPages$1() {
fxy060608's avatar
fxy060608 已提交
1730
  return [];
fxy060608's avatar
fxy060608 已提交
1731 1732 1733
}
function mergeTitleNView(navigationBar, titleNView) {
  if (isPlainObject(titleNView)) {
fxy060608's avatar
fxy060608 已提交
1734 1735
    if (hasOwn(titleNView, "backgroundColor")) {
      navigationBar.backgroundColor = titleNView.backgroundColor;
fxy060608's avatar
fxy060608 已提交
1736
    }
fxy060608's avatar
fxy060608 已提交
1737 1738
    if (hasOwn(titleNView, "buttons")) {
      navigationBar.buttons = titleNView.buttons;
fxy060608's avatar
fxy060608 已提交
1739
    }
fxy060608's avatar
fxy060608 已提交
1740 1741
    if (hasOwn(titleNView, "titleColor")) {
      navigationBar.textColor = titleNView.titleColor;
fxy060608's avatar
fxy060608 已提交
1742
    }
fxy060608's avatar
fxy060608 已提交
1743 1744
    if (hasOwn(titleNView, "titleText")) {
      navigationBar.titleText = titleNView.titleText;
fxy060608's avatar
fxy060608 已提交
1745
    }
fxy060608's avatar
fxy060608 已提交
1746 1747
    if (hasOwn(titleNView, "titleSize")) {
      navigationBar.titleSize = titleNView.titleSize;
fxy060608's avatar
fxy060608 已提交
1748
    }
fxy060608's avatar
fxy060608 已提交
1749 1750
    if (hasOwn(titleNView, "type")) {
      navigationBar.type = titleNView.type;
fxy060608's avatar
fxy060608 已提交
1751
    }
fxy060608's avatar
fxy060608 已提交
1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762
    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 已提交
1763 1764
    }
  }
fxy060608's avatar
fxy060608 已提交
1765
  return navigationBar;
fxy060608's avatar
fxy060608 已提交
1766 1767
}
function appendCss(css, cssId, replace = false) {
fxy060608's avatar
fxy060608 已提交
1768
  let style = document.getElementById(cssId);
fxy060608's avatar
fxy060608 已提交
1769
  if (style && replace) {
fxy060608's avatar
fxy060608 已提交
1770 1771
    style.parentNode.removeChild(style);
    style = null;
fxy060608's avatar
fxy060608 已提交
1772 1773
  }
  if (!style) {
fxy060608's avatar
fxy060608 已提交
1774 1775 1776 1777
    style = document.createElement("style");
    style.type = "text/css";
    cssId && (style.id = cssId);
    document.getElementsByTagName("head")[0].appendChild(style);
fxy060608's avatar
fxy060608 已提交
1778
  }
fxy060608's avatar
fxy060608 已提交
1779
  style.appendChild(document.createTextNode(css));
fxy060608's avatar
fxy060608 已提交
1780 1781
}
function hexToRgba(hex) {
fxy060608's avatar
fxy060608 已提交
1782 1783 1784 1785
  let r;
  let g;
  let b;
  hex = hex.replace("#", "");
fxy060608's avatar
fxy060608 已提交
1786
  if (hex.length === 6) {
fxy060608's avatar
fxy060608 已提交
1787 1788 1789
    r = hex.substring(0, 2);
    g = hex.substring(2, 4);
    b = hex.substring(4, 6);
fxy060608's avatar
fxy060608 已提交
1790
  } else if (hex.length === 3) {
fxy060608's avatar
fxy060608 已提交
1791 1792 1793
    r = hex.substring(0, 1);
    g = hex.substring(1, 2);
    b = hex.substring(2, 3);
fxy060608's avatar
fxy060608 已提交
1794
  } else {
fxy060608's avatar
fxy060608 已提交
1795
    return false;
fxy060608's avatar
fxy060608 已提交
1796 1797
  }
  if (r.length === 1) {
fxy060608's avatar
fxy060608 已提交
1798
    r += r;
fxy060608's avatar
fxy060608 已提交
1799 1800
  }
  if (g.length === 1) {
fxy060608's avatar
fxy060608 已提交
1801
    g += g;
fxy060608's avatar
fxy060608 已提交
1802 1803
  }
  if (b.length === 1) {
fxy060608's avatar
fxy060608 已提交
1804
    b += b;
fxy060608's avatar
fxy060608 已提交
1805
  }
fxy060608's avatar
fxy060608 已提交
1806 1807 1808
  r = parseInt(r, 16);
  g = parseInt(g, 16);
  b = parseInt(b, 16);
fxy060608's avatar
fxy060608 已提交
1809 1810 1811 1812
  return {
    r,
    g,
    b
fxy060608's avatar
fxy060608 已提交
1813
  };
fxy060608's avatar
fxy060608 已提交
1814 1815 1816
}
var transparent = {
  mounted() {
fxy060608's avatar
fxy060608 已提交
1817 1818 1819 1820 1821 1822
    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 已提交
1823
      for (let i = 0; i < iconElems.length; i++) {
fxy060608's avatar
fxy060608 已提交
1824
        iconElemsStyles.push(iconElems[i].style);
fxy060608's avatar
fxy060608 已提交
1825
      }
fxy060608's avatar
fxy060608 已提交
1826 1827 1828
      const borderRadiusElems = this.$el.querySelectorAll(".uni-page-head-btn");
      const oldColors = [];
      const borderRadiusElemsStyles = [];
fxy060608's avatar
fxy060608 已提交
1829
      for (let i = 0; i < borderRadiusElems.length; i++) {
fxy060608's avatar
fxy060608 已提交
1830 1831 1832
        const borderRadiusElem = borderRadiusElems[i];
        oldColors.push(getComputedStyle(borderRadiusElem).backgroundColor);
        borderRadiusElemsStyles.push(borderRadiusElem.style);
fxy060608's avatar
fxy060608 已提交
1833
      }
fxy060608's avatar
fxy060608 已提交
1834 1835 1836
      this._A = 0;
      UniViewJSBridge.on("onPageScroll", ({scrollTop}) => {
        const alpha = Math.min(scrollTop / this.offset, 1);
fxy060608's avatar
fxy060608 已提交
1837
        if (alpha === 1 && this._A === 1) {
fxy060608's avatar
fxy060608 已提交
1838
          return;
fxy060608's avatar
fxy060608 已提交
1839 1840 1841
        }
        if (alpha > 0.5 && this._A <= 0.5) {
          iconElemsStyles.forEach(function(iconElemStyle) {
fxy060608's avatar
fxy060608 已提交
1842 1843
            iconElemStyle.color = textColor;
          });
fxy060608's avatar
fxy060608 已提交
1844 1845
        } else if (alpha <= 0.5 && this._A > 0.5) {
          iconElemsStyles.forEach(function(iconElemStyle) {
fxy060608's avatar
fxy060608 已提交
1846 1847
            iconElemStyle.color = "#fff";
          });
fxy060608's avatar
fxy060608 已提交
1848
        }
fxy060608's avatar
fxy060608 已提交
1849
        this._A = alpha;
fxy060608's avatar
fxy060608 已提交
1850
        if (titleElem) {
fxy060608's avatar
fxy060608 已提交
1851
          titleElem.style.opacity = alpha;
fxy060608's avatar
fxy060608 已提交
1852
        }
fxy060608's avatar
fxy060608 已提交
1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863
        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 已提交
1864
      for (let i = 0; i < iconElems.length; i++) {
fxy060608's avatar
fxy060608 已提交
1865
        iconElemsStyles.push(iconElems[i].style);
fxy060608's avatar
fxy060608 已提交
1866
      }
fxy060608's avatar
fxy060608 已提交
1867 1868 1869
      const borderRadiusElems = this.$el.querySelectorAll(".uni-page-head-btn");
      const oldColors = [];
      const borderRadiusElemsStyles = [];
fxy060608's avatar
fxy060608 已提交
1870
      for (let i = 0; i < borderRadiusElems.length; i++) {
fxy060608's avatar
fxy060608 已提交
1871 1872 1873
        const borderRadiusElem = borderRadiusElems[i];
        oldColors.push(getComputedStyle(borderRadiusElem).backgroundColor);
        borderRadiusElemsStyles.push(borderRadiusElem.style);
fxy060608's avatar
fxy060608 已提交
1874 1875 1876 1877 1878
      }
    }
  },
  computed: {
    color() {
fxy060608's avatar
fxy060608 已提交
1879
      return this.type === "transparent" ? "#fff" : this.textColor;
fxy060608's avatar
fxy060608 已提交
1880 1881
    },
    offset() {
fxy060608's avatar
fxy060608 已提交
1882
      return parseInt(this.coverage);
fxy060608's avatar
fxy060608 已提交
1883 1884
    },
    bgColor() {
fxy060608's avatar
fxy060608 已提交
1885 1886 1887 1888 1889 1890
      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 已提交
1891
      }
fxy060608's avatar
fxy060608 已提交
1892
      return this.backgroundColor;
fxy060608's avatar
fxy060608 已提交
1893 1894
    }
  }
fxy060608's avatar
fxy060608 已提交
1895
};
fxy060608's avatar
fxy060608 已提交
1896
const FONTS = {
fxy060608's avatar
fxy060608 已提交
1897 1898 1899 1900 1901 1902 1903 1904
  forward: "&#xe600;",
  back: "&#xe601;",
  share: "&#xe602;",
  favorite: "&#xe604;",
  home: "&#xe605;",
  menu: "&#xe606;",
  close: "&#xe650;"
};
fxy060608's avatar
fxy060608 已提交
1905
var script$5 = {
fxy060608's avatar
fxy060608 已提交
1906
  name: "PageHead",
fxy060608's avatar
fxy060608 已提交
1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918
  mixins: [transparent],
  components: {
    VUniInput: Input
  },
  props: {
    backButton: {
      type: Boolean,
      default: true
    },
    backgroundColor: {
      type: String,
      default() {
fxy060608's avatar
fxy060608 已提交
1919
        return this.type === "transparent" ? "#000" : "#F8F8F8";
fxy060608's avatar
fxy060608 已提交
1920 1921 1922 1923
      }
    },
    textColor: {
      type: String,
fxy060608's avatar
fxy060608 已提交
1924
      default: "#fff"
fxy060608's avatar
fxy060608 已提交
1925 1926 1927
    },
    titleText: {
      type: String,
fxy060608's avatar
fxy060608 已提交
1928
      default: ""
fxy060608's avatar
fxy060608 已提交
1929 1930 1931
    },
    duration: {
      type: String,
fxy060608's avatar
fxy060608 已提交
1932
      default: "0"
fxy060608's avatar
fxy060608 已提交
1933 1934 1935
    },
    timingFunc: {
      type: String,
fxy060608's avatar
fxy060608 已提交
1936
      default: ""
fxy060608's avatar
fxy060608 已提交
1937 1938 1939 1940 1941 1942 1943
    },
    loading: {
      type: Boolean,
      default: false
    },
    titleSize: {
      type: String,
fxy060608's avatar
fxy060608 已提交
1944
      default: "16px"
fxy060608's avatar
fxy060608 已提交
1945 1946
    },
    type: {
fxy060608's avatar
fxy060608 已提交
1947
      default: "default",
fxy060608's avatar
fxy060608 已提交
1948
      validator(value) {
fxy060608's avatar
fxy060608 已提交
1949
        return ["default", "transparent", "float"].indexOf(value) !== -1;
fxy060608's avatar
fxy060608 已提交
1950 1951 1952 1953
      }
    },
    coverage: {
      type: String,
fxy060608's avatar
fxy060608 已提交
1954
      default: "132px"
fxy060608's avatar
fxy060608 已提交
1955 1956 1957 1958
    },
    buttons: {
      type: Array,
      default() {
fxy060608's avatar
fxy060608 已提交
1959
        return [];
fxy060608's avatar
fxy060608 已提交
1960 1961 1962 1963 1964
      }
    },
    searchInput: {
      type: [Object, Boolean],
      default() {
fxy060608's avatar
fxy060608 已提交
1965
        return false;
fxy060608's avatar
fxy060608 已提交
1966 1967 1968 1969
      }
    },
    titleImage: {
      type: String,
fxy060608's avatar
fxy060608 已提交
1970
      default: ""
fxy060608's avatar
fxy060608 已提交
1971 1972 1973 1974 1975 1976 1977 1978
    },
    titlePenetrate: {
      type: Boolean,
      default: false
    },
    shadow: {
      type: Object,
      default() {
fxy060608's avatar
fxy060608 已提交
1979
        return {};
fxy060608's avatar
fxy060608 已提交
1980 1981 1982 1983 1984 1985
      }
    }
  },
  data() {
    return {
      focus: false,
fxy060608's avatar
fxy060608 已提交
1986
      text: "",
fxy060608's avatar
fxy060608 已提交
1987
      composing: false
fxy060608's avatar
fxy060608 已提交
1988
    };
fxy060608's avatar
fxy060608 已提交
1989 1990 1991
  },
  computed: {
    btns() {
fxy060608's avatar
fxy060608 已提交
1992 1993
      const btns = [];
      const fonts = {};
fxy060608's avatar
fxy060608 已提交
1994
      if (this.buttons.length) {
fxy060608's avatar
fxy060608 已提交
1995 1996
        this.buttons.forEach((button) => {
          const btn = Object.assign({}, button);
fxy060608's avatar
fxy060608 已提交
1997
          if (btn.fontSrc && !btn.fontFamily) {
fxy060608's avatar
fxy060608 已提交
1998 1999
            const fontSrc = btn.fontSrc = this.$getRealPath(btn.fontSrc);
            let fontFamily;
fxy060608's avatar
fxy060608 已提交
2000
            if (fontSrc in fonts) {
fxy060608's avatar
fxy060608 已提交
2001
              fontFamily = fonts[fontSrc];
fxy060608's avatar
fxy060608 已提交
2002
            } else {
fxy060608's avatar
fxy060608 已提交
2003 2004 2005 2006
              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 已提交
2007
            }
fxy060608's avatar
fxy060608 已提交
2008
            btn.fontFamily = fontFamily;
fxy060608's avatar
fxy060608 已提交
2009
          }
fxy060608's avatar
fxy060608 已提交
2010 2011
          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 已提交
2012
          if (/\d$/.test(fontSize)) {
fxy060608's avatar
fxy060608 已提交
2013
            fontSize += "px";
fxy060608's avatar
fxy060608 已提交
2014
          }
fxy060608's avatar
fxy060608 已提交
2015 2016 2017 2018
          btn.fontSize = fontSize;
          btn.fontWeight = btn.fontWeight || "normal";
          btns.push(btn);
        });
fxy060608's avatar
fxy060608 已提交
2019
      }
fxy060608's avatar
fxy060608 已提交
2020
      return btns;
fxy060608's avatar
fxy060608 已提交
2021 2022
    },
    leftBtns() {
fxy060608's avatar
fxy060608 已提交
2023
      return this.btns.filter((btn) => btn.float === "left");
fxy060608's avatar
fxy060608 已提交
2024 2025
    },
    rightBtns() {
fxy060608's avatar
fxy060608 已提交
2026
      return this.btns.filter((btn) => btn.float !== "left");
fxy060608's avatar
fxy060608 已提交
2027 2028
    },
    headClass() {
fxy060608's avatar
fxy060608 已提交
2029
      const shadowColorType = this.shadow.colorType;
fxy060608's avatar
fxy060608 已提交
2030
      const data = {
fxy060608's avatar
fxy060608 已提交
2031 2032 2033 2034
        "uni-page-head-transparent": this.type === "transparent",
        "uni-page-head-titlePenetrate": this.titlePenetrate,
        "uni-page-head-shadow": shadowColorType
      };
fxy060608's avatar
fxy060608 已提交
2035
      if (shadowColorType) {
fxy060608's avatar
fxy060608 已提交
2036
        data[`uni-page-head-shadow-${shadowColorType}`] = shadowColorType;
fxy060608's avatar
fxy060608 已提交
2037
      }
fxy060608's avatar
fxy060608 已提交
2038
      return data;
fxy060608's avatar
fxy060608 已提交
2039 2040 2041 2042
    }
  },
  mounted() {
    if (this.searchInput) {
fxy060608's avatar
fxy060608 已提交
2043 2044 2045 2046
      const input = this.$refs.input;
      input.$watch("composing", (val) => {
        this.composing = val;
      });
fxy060608's avatar
fxy060608 已提交
2047
      if (this.searchInput.disabled) {
fxy060608's avatar
fxy060608 已提交
2048 2049 2050
        input.$el.addEventListener("click", () => {
          UniServiceJSBridge.emit("onNavigationBarSearchInputClicked", "");
        });
fxy060608's avatar
fxy060608 已提交
2051
      } else {
fxy060608's avatar
fxy060608 已提交
2052 2053 2054
        input.$refs.input.addEventListener("keyup", (event) => {
          if (event.key.toUpperCase() === "ENTER") {
            UniServiceJSBridge.emit("onNavigationBarSearchInputConfirmed", {
fxy060608's avatar
fxy060608 已提交
2055
              text: this.text
fxy060608's avatar
fxy060608 已提交
2056
            });
fxy060608's avatar
fxy060608 已提交
2057
          }
fxy060608's avatar
fxy060608 已提交
2058 2059 2060
        });
        input.$refs.input.addEventListener("focus", () => {
          UniServiceJSBridge.emit("onNavigationBarSearchInputFocusChanged", {
fxy060608's avatar
fxy060608 已提交
2061
            focus: true
fxy060608's avatar
fxy060608 已提交
2062 2063 2064 2065
          });
        });
        input.$refs.input.addEventListener("blur", () => {
          UniServiceJSBridge.emit("onNavigationBarSearchInputFocusChanged", {
fxy060608's avatar
fxy060608 已提交
2066
            focus: false
fxy060608's avatar
fxy060608 已提交
2067 2068
          });
        });
fxy060608's avatar
fxy060608 已提交
2069 2070 2071 2072 2073 2074 2075
      }
    }
  },
  methods: {
    _back() {
      if (getCurrentPages().length === 1) {
        uni.reLaunch({
fxy060608's avatar
fxy060608 已提交
2076 2077
          url: "/"
        });
fxy060608's avatar
fxy060608 已提交
2078 2079
      } else {
        uni.navigateBack({
fxy060608's avatar
fxy060608 已提交
2080 2081
          from: "backbutton"
        });
fxy060608's avatar
fxy060608 已提交
2082 2083 2084
      }
    },
    _onBtnClick(index2) {
fxy060608's avatar
fxy060608 已提交
2085 2086 2087
      UniServiceJSBridge.emit("onNavigationBarButtonTap", Object.assign({}, this.btns[index2], {
        index: index2
      }));
fxy060608's avatar
fxy060608 已提交
2088 2089 2090
    },
    _formatBtnFontText(btn) {
      if (btn.fontSrc && btn.fontFamily) {
fxy060608's avatar
fxy060608 已提交
2091
        return btn.text.replace("\\u", "&#x");
fxy060608's avatar
fxy060608 已提交
2092
      } else if (FONTS[btn.type]) {
fxy060608's avatar
fxy060608 已提交
2093
        return FONTS[btn.type];
fxy060608's avatar
fxy060608 已提交
2094
      }
fxy060608's avatar
fxy060608 已提交
2095
      return btn.text || "";
fxy060608's avatar
fxy060608 已提交
2096 2097 2098 2099 2100 2101
    },
    _formatBtnStyle(btn) {
      const style = {
        color: btn.color,
        fontSize: btn.fontSize,
        fontWeight: btn.fontWeight
fxy060608's avatar
fxy060608 已提交
2102
      };
fxy060608's avatar
fxy060608 已提交
2103
      if (btn.fontFamily) {
fxy060608's avatar
fxy060608 已提交
2104
        style.fontFamily = btn.fontFamily;
fxy060608's avatar
fxy060608 已提交
2105
      }
fxy060608's avatar
fxy060608 已提交
2106
      return style;
fxy060608's avatar
fxy060608 已提交
2107 2108
    },
    _focus() {
fxy060608's avatar
fxy060608 已提交
2109
      this.focus = true;
fxy060608's avatar
fxy060608 已提交
2110 2111
    },
    _blur() {
fxy060608's avatar
fxy060608 已提交
2112
      this.focus = false;
fxy060608's avatar
fxy060608 已提交
2113 2114
    },
    _input(text) {
fxy060608's avatar
fxy060608 已提交
2115
      UniServiceJSBridge.emit("onNavigationBarSearchInputChanged", {
fxy060608's avatar
fxy060608 已提交
2116
        text
fxy060608's avatar
fxy060608 已提交
2117
      });
fxy060608's avatar
fxy060608 已提交
2118 2119
    }
  }
fxy060608's avatar
fxy060608 已提交
2120 2121
};
const _hoisted_1$4 = {class: "uni-page-head-hd"};
fxy060608's avatar
fxy060608 已提交
2122 2123
const _hoisted_2$4 = {
  key: 0,
fxy060608's avatar
fxy060608 已提交
2124 2125
  class: "uni-page-head-bd"
};
fxy060608's avatar
fxy060608 已提交
2126 2127
const _hoisted_3$3 = {
  key: 0,
fxy060608's avatar
fxy060608 已提交
2128 2129 2130
  class: "uni-loading"
};
const _hoisted_4$2 = {class: "uni-page-head-ft"};
fxy060608's avatar
fxy060608 已提交
2131
function render$5(_ctx, _cache, $props, $setup, $data, $options) {
fxy060608's avatar
fxy060608 已提交
2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232
  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 已提交
2233
var script$6 = {
fxy060608's avatar
fxy060608 已提交
2234 2235
  name: "PageBody"
};
fxy060608's avatar
fxy060608 已提交
2236
function render$6(_ctx, _cache, $props, $setup, $data, $options) {
fxy060608's avatar
fxy060608 已提交
2237 2238 2239
  return openBlock(), createBlock("uni-page-wrapper", null, [
    createVNode("uni-page-body", null, [
      renderSlot(_ctx.$slots, "default")
fxy060608's avatar
fxy060608 已提交
2240
    ])
fxy060608's avatar
fxy060608 已提交
2241
  ]);
fxy060608's avatar
fxy060608 已提交
2242
}
fxy060608's avatar
fxy060608 已提交
2243 2244 2245
;
script$6.render = render$6;
script$6.__file = "packages/uni-h5/src/framework/components/page/pageBody.vue";
fxy060608's avatar
fxy060608 已提交
2246
var script$7 = {
fxy060608's avatar
fxy060608 已提交
2247
  name: "PageRefresh",
fxy060608's avatar
fxy060608 已提交
2248 2249 2250
  props: {
    color: {
      type: String,
fxy060608's avatar
fxy060608 已提交
2251
      default: "#2BD009"
fxy060608's avatar
fxy060608 已提交
2252 2253 2254 2255 2256 2257
    },
    offset: {
      type: Number,
      default: 0
    }
  }
fxy060608's avatar
fxy060608 已提交
2258 2259 2260 2261 2262 2263 2264
};
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 已提交
2265
const _hoisted_4$3 = {
fxy060608's avatar
fxy060608 已提交
2266 2267 2268 2269 2270
  class: "uni-page-refresh__spinner",
  width: "24",
  height: "24",
  viewBox: "25 25 50 50"
};
fxy060608's avatar
fxy060608 已提交
2271
function render$7(_ctx, _cache, $props, $setup, $data, $options) {
fxy060608's avatar
fxy060608 已提交
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
  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 已提交
2307
function processDeltaY(evt, identifier, startY) {
fxy060608's avatar
fxy060608 已提交
2308
  const touch = Array.prototype.slice.call(evt.changedTouches).filter((touch2) => touch2.identifier === identifier)[0];
fxy060608's avatar
fxy060608 已提交
2309
  if (!touch) {
fxy060608's avatar
fxy060608 已提交
2310
    return false;
fxy060608's avatar
fxy060608 已提交
2311
  }
fxy060608's avatar
fxy060608 已提交
2312 2313
  evt.deltaY = touch.pageY - startY;
  return true;
fxy060608's avatar
fxy060608 已提交
2314
}
fxy060608's avatar
fxy060608 已提交
2315 2316 2317 2318 2319
const PULLING = "pulling";
const REACHED = "reached";
const ABORTING = "aborting";
const REFRESHING = "refreshing";
const RESTORING = "restoring";
fxy060608's avatar
fxy060608 已提交
2320 2321 2322
var pullToRefresh = {
  mounted() {
    if (this.enablePullDownRefresh) {
fxy060608's avatar
fxy060608 已提交
2323 2324 2325 2326 2327 2328 2329 2330 2331 2332
      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 已提交
2333
        }
fxy060608's avatar
fxy060608 已提交
2334 2335 2336 2337 2338 2339 2340 2341 2342 2343
      });
      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 已提交
2344
        }
fxy060608's avatar
fxy060608 已提交
2345
      });
fxy060608's avatar
fxy060608 已提交
2346 2347 2348 2349
    }
  },
  methods: {
    _touchstart(evt) {
fxy060608's avatar
fxy060608 已提交
2350 2351 2352
      const touch = evt.changedTouches[0];
      this.touchId = touch.identifier;
      this.startY = touch.pageY;
fxy060608's avatar
fxy060608 已提交
2353
      if ([ABORTING, REFRESHING, RESTORING].indexOf(this.state) >= 0) {
fxy060608's avatar
fxy060608 已提交
2354
        this.canRefresh = false;
fxy060608's avatar
fxy060608 已提交
2355
      } else {
fxy060608's avatar
fxy060608 已提交
2356
        this.canRefresh = true;
fxy060608's avatar
fxy060608 已提交
2357 2358 2359 2360
      }
    },
    _touchmove(evt) {
      if (!this.canRefresh) {
fxy060608's avatar
fxy060608 已提交
2361
        return;
fxy060608's avatar
fxy060608 已提交
2362 2363
      }
      if (!processDeltaY(evt, this.touchId, this.startY)) {
fxy060608's avatar
fxy060608 已提交
2364
        return;
fxy060608's avatar
fxy060608 已提交
2365
      }
fxy060608's avatar
fxy060608 已提交
2366 2367 2368 2369
      let {deltaY} = evt;
      if ((document.documentElement.scrollTop || document.body.scrollTop) !== 0) {
        this.touchId = null;
        return;
fxy060608's avatar
fxy060608 已提交
2370 2371
      }
      if (deltaY < 0 && !this.state) {
fxy060608's avatar
fxy060608 已提交
2372
        return;
fxy060608's avatar
fxy060608 已提交
2373
      }
fxy060608's avatar
fxy060608 已提交
2374
      evt.preventDefault();
fxy060608's avatar
fxy060608 已提交
2375
      if (this.distance == null) {
fxy060608's avatar
fxy060608 已提交
2376 2377 2378
        this.offset = deltaY;
        this.state = PULLING;
        this._addClass();
fxy060608's avatar
fxy060608 已提交
2379
      }
fxy060608's avatar
fxy060608 已提交
2380
      deltaY = deltaY - this.offset;
fxy060608's avatar
fxy060608 已提交
2381
      if (deltaY < 0) {
fxy060608's avatar
fxy060608 已提交
2382
        deltaY = 0;
fxy060608's avatar
fxy060608 已提交
2383
      }
fxy060608's avatar
fxy060608 已提交
2384 2385 2386
      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 已提交
2387
      if (reached || pulling) {
fxy060608's avatar
fxy060608 已提交
2388 2389 2390
        this._removeClass();
        this.state = this.state === REACHED ? PULLING : REACHED;
        this._addClass();
fxy060608's avatar
fxy060608 已提交
2391
      }
fxy060608's avatar
fxy060608 已提交
2392
      this._pulling(deltaY);
fxy060608's avatar
fxy060608 已提交
2393 2394 2395
    },
    _touchend(evt) {
      if (!processDeltaY(evt, this.touchId, this.startY)) {
fxy060608's avatar
fxy060608 已提交
2396
        return;
fxy060608's avatar
fxy060608 已提交
2397 2398
      }
      if (this.state === null) {
fxy060608's avatar
fxy060608 已提交
2399
        return;
fxy060608's avatar
fxy060608 已提交
2400 2401
      }
      if (this.state === PULLING) {
fxy060608's avatar
fxy060608 已提交
2402 2403 2404
        this._removeClass();
        this.state = ABORTING;
        this._addClass();
fxy060608's avatar
fxy060608 已提交
2405
        this._aborting(() => {
fxy060608's avatar
fxy060608 已提交
2406 2407 2408
          this._removeClass();
          this.state = this.distance = this.offset = null;
        });
fxy060608's avatar
fxy060608 已提交
2409
      } else if (this.state === REACHED) {
fxy060608's avatar
fxy060608 已提交
2410 2411 2412 2413
        this._removeClass();
        this.state = REFRESHING;
        this._addClass();
        this._refreshing();
fxy060608's avatar
fxy060608 已提交
2414 2415 2416 2417
      }
    },
    _toggleClass(type) {
      if (!this.state) {
fxy060608's avatar
fxy060608 已提交
2418
        return;
fxy060608's avatar
fxy060608 已提交
2419
      }
fxy060608's avatar
fxy060608 已提交
2420
      const elem = this.refreshContainerElem;
fxy060608's avatar
fxy060608 已提交
2421
      if (elem) {
fxy060608's avatar
fxy060608 已提交
2422
        elem.classList[type]("uni-page-refresh--" + this.state);
fxy060608's avatar
fxy060608 已提交
2423 2424 2425
      }
    },
    _addClass() {
fxy060608's avatar
fxy060608 已提交
2426
      this._toggleClass("add");
fxy060608's avatar
fxy060608 已提交
2427 2428
    },
    _removeClass() {
fxy060608's avatar
fxy060608 已提交
2429
      this._toggleClass("remove");
fxy060608's avatar
fxy060608 已提交
2430 2431
    },
    _pulling(deltaY) {
fxy060608's avatar
fxy060608 已提交
2432
      const elem = this.refreshControllerElem;
fxy060608's avatar
fxy060608 已提交
2433
      if (!elem) {
fxy060608's avatar
fxy060608 已提交
2434
        return;
fxy060608's avatar
fxy060608 已提交
2435
      }
fxy060608's avatar
fxy060608 已提交
2436 2437
      const style = elem.style;
      let rotate = deltaY / this.refreshOptions.range;
fxy060608's avatar
fxy060608 已提交
2438
      if (rotate > 1) {
fxy060608's avatar
fxy060608 已提交
2439
        rotate = 1;
fxy060608's avatar
fxy060608 已提交
2440
      } else {
fxy060608's avatar
fxy060608 已提交
2441
        rotate = rotate * rotate * rotate;
fxy060608's avatar
fxy060608 已提交
2442
      }
fxy060608's avatar
fxy060608 已提交
2443 2444 2445 2446 2447
      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 已提交
2448 2449
    },
    _aborting(callback) {
fxy060608's avatar
fxy060608 已提交
2450
      const elem = this.refreshControllerElem;
fxy060608's avatar
fxy060608 已提交
2451
      if (!elem) {
fxy060608's avatar
fxy060608 已提交
2452
        return;
fxy060608's avatar
fxy060608 已提交
2453
      }
fxy060608's avatar
fxy060608 已提交
2454
      const style = elem.style;
fxy060608's avatar
fxy060608 已提交
2455
      if (style.webkitTransform) {
fxy060608's avatar
fxy060608 已提交
2456 2457
        style.webkitTransition = "-webkit-transform 0.3s";
        style.webkitTransform = "translate3d(-50%, 0, 0)";
fxy060608's avatar
fxy060608 已提交
2458
        const abortTransitionEnd = function() {
fxy060608's avatar
fxy060608 已提交
2459 2460 2461 2462 2463 2464 2465
          timeout && clearTimeout(timeout);
          elem.removeEventListener("webkitTransitionEnd", abortTransitionEnd);
          style.webkitTransition = "";
          callback();
        };
        elem.addEventListener("webkitTransitionEnd", abortTransitionEnd);
        const timeout = setTimeout(abortTransitionEnd, 350);
fxy060608's avatar
fxy060608 已提交
2466
      } else {
fxy060608's avatar
fxy060608 已提交
2467
        callback();
fxy060608's avatar
fxy060608 已提交
2468 2469 2470
      }
    },
    _refreshing() {
fxy060608's avatar
fxy060608 已提交
2471
      const elem = this.refreshControllerElem;
fxy060608's avatar
fxy060608 已提交
2472
      if (!elem) {
fxy060608's avatar
fxy060608 已提交
2473 2474 2475 2476 2477 2478
        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 已提交
2479 2480
    },
    _restoring(callback) {
fxy060608's avatar
fxy060608 已提交
2481
      const elem = this.refreshControllerElem;
fxy060608's avatar
fxy060608 已提交
2482
      if (!elem) {
fxy060608's avatar
fxy060608 已提交
2483
        return;
fxy060608's avatar
fxy060608 已提交
2484
      }
fxy060608's avatar
fxy060608 已提交
2485 2486 2487
      const style = elem.style;
      style.webkitTransition = "-webkit-transform 0.3s";
      style.webkitTransform += " scale(0.01)";
fxy060608's avatar
fxy060608 已提交
2488
      const restoreTransitionEnd = function() {
fxy060608's avatar
fxy060608 已提交
2489 2490 2491 2492 2493 2494 2495 2496
        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 已提交
2497 2498
    }
  }
fxy060608's avatar
fxy060608 已提交
2499
};
fxy060608's avatar
fxy060608 已提交
2500
var script$8 = {
fxy060608's avatar
fxy060608 已提交
2501 2502
  name: "Page",
  mpType: "page",
fxy060608's avatar
fxy060608 已提交
2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527
  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 已提交
2528
      default: "#000"
fxy060608's avatar
fxy060608 已提交
2529 2530
    },
    navigationBarTextStyle: {
fxy060608's avatar
fxy060608 已提交
2531
      default: "white",
fxy060608's avatar
fxy060608 已提交
2532
      validator(value) {
fxy060608's avatar
fxy060608 已提交
2533
        return ["white", "black"].indexOf(value) !== -1;
fxy060608's avatar
fxy060608 已提交
2534 2535 2536 2537
      }
    },
    navigationBarTitleText: {
      type: String,
fxy060608's avatar
fxy060608 已提交
2538
      default: ""
fxy060608's avatar
fxy060608 已提交
2539 2540
    },
    navigationStyle: {
fxy060608's avatar
fxy060608 已提交
2541
      default: "default",
fxy060608's avatar
fxy060608 已提交
2542
      validator(value) {
fxy060608's avatar
fxy060608 已提交
2543
        return ["default", "custom"].indexOf(value) !== -1;
fxy060608's avatar
fxy060608 已提交
2544 2545 2546 2547
      }
    },
    backgroundColor: {
      type: String,
fxy060608's avatar
fxy060608 已提交
2548
      default: "#ffffff"
fxy060608's avatar
fxy060608 已提交
2549 2550
    },
    backgroundTextStyle: {
fxy060608's avatar
fxy060608 已提交
2551
      default: "dark",
fxy060608's avatar
fxy060608 已提交
2552
      validator(value) {
fxy060608's avatar
fxy060608 已提交
2553
        return ["dark", "light"].indexOf(value) !== -1;
fxy060608's avatar
fxy060608 已提交
2554 2555 2556 2557
      }
    },
    backgroundColorTop: {
      type: String,
fxy060608's avatar
fxy060608 已提交
2558
      default: "#fff"
fxy060608's avatar
fxy060608 已提交
2559 2560 2561
    },
    backgroundColorBottom: {
      type: String,
fxy060608's avatar
fxy060608 已提交
2562
      default: "#fff"
fxy060608's avatar
fxy060608 已提交
2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577
    },
    enablePullDownRefresh: {
      type: Boolean,
      default: false
    },
    onReachBottomDistance: {
      type: Number,
      default: 50
    },
    disableScroll: {
      type: Boolean,
      default: false
    },
    titleNView: {
      type: [Boolean, Object, String],
fxy060608's avatar
fxy060608 已提交
2578
      default: ""
fxy060608's avatar
fxy060608 已提交
2579 2580 2581 2582
    },
    pullToRefresh: {
      type: Object,
      default() {
fxy060608's avatar
fxy060608 已提交
2583
        return {};
fxy060608's avatar
fxy060608 已提交
2584 2585 2586 2587
      }
    },
    titleImage: {
      type: String,
fxy060608's avatar
fxy060608 已提交
2588
      default: ""
fxy060608's avatar
fxy060608 已提交
2589 2590 2591
    },
    transparentTitle: {
      type: String,
fxy060608's avatar
fxy060608 已提交
2592
      default: ""
fxy060608's avatar
fxy060608 已提交
2593 2594 2595
    },
    titlePenetrate: {
      type: String,
fxy060608's avatar
fxy060608 已提交
2596
      default: "NO"
fxy060608's avatar
fxy060608 已提交
2597 2598 2599 2600
    },
    navigationBarShadow: {
      type: Object,
      default() {
fxy060608's avatar
fxy060608 已提交
2601
        return {};
fxy060608's avatar
fxy060608 已提交
2602 2603 2604 2605 2606
      }
    }
  },
  data() {
    const titleNViewTypeList = {
fxy060608's avatar
fxy060608 已提交
2607 2608 2609 2610 2611 2612
      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 已提交
2613
      titleNView = {
fxy060608's avatar
fxy060608 已提交
2614 2615
        type: "none"
      };
fxy060608's avatar
fxy060608 已提交
2616
    } else {
fxy060608's avatar
fxy060608 已提交
2617 2618 2619 2620 2621 2622 2623
      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 已提交
2624 2625 2626 2627
    }
    const yesNoParseList = {
      YES: true,
      NO: false
fxy060608's avatar
fxy060608 已提交
2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655
    };
    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 已提交
2656 2657 2658
    return {
      navigationBar,
      refreshOptions
fxy060608's avatar
fxy060608 已提交
2659
    };
fxy060608's avatar
fxy060608 已提交
2660 2661
  },
  created() {
fxy060608's avatar
fxy060608 已提交
2662 2663 2664
    const navigationBar = this.navigationBar;
    document.title = navigationBar.titleText;
    UniServiceJSBridge.emit("onNavigationBarChange", navigationBar);
fxy060608's avatar
fxy060608 已提交
2665
  }
fxy060608's avatar
fxy060608 已提交
2666
};
fxy060608's avatar
fxy060608 已提交
2667
function render$8(_ctx, _cache, $props, $setup, $data, $options) {
fxy060608's avatar
fxy060608 已提交
2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702
  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 已提交
2703
var script$9 = {
fxy060608's avatar
fxy060608 已提交
2704
  name: "AsyncError",
fxy060608's avatar
fxy060608 已提交
2705 2706
  methods: {
    _onClick() {
fxy060608's avatar
fxy060608 已提交
2707
      window.location.reload();
fxy060608's avatar
fxy060608 已提交
2708 2709
    }
  }
fxy060608's avatar
fxy060608 已提交
2710
};
fxy060608's avatar
fxy060608 已提交
2711
function render$9(_ctx, _cache, $props, $setup, $data, $options) {
fxy060608's avatar
fxy060608 已提交
2712 2713 2714 2715 2716 2717 2718 2719
  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 已提交
2720
var script$a = {
fxy060608's avatar
fxy060608 已提交
2721 2722 2723 2724
  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 已提交
2725
function render$a(_ctx, _cache, $props, $setup, $data, $options) {
fxy060608's avatar
fxy060608 已提交
2726 2727 2728 2729 2730 2731 2732 2733
  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";
export {script$9 as AsyncErrorComponent, script$a as AsyncLoadingComponent, script$8 as PageComponent, addInterceptor, arrayBufferToBase64, base64ToArrayBuffer, canIUse, createIntersectionObserver$1 as createIntersectionObserver, createSelectorQuery$1 as createSelectorQuery, getApp, getCurrentPages$1 as getCurrentPages, getSystemInfo, getSystemInfoSync, makePhoneCall, navigateBack, navigateTo, openDocument, index as plugin, promiseInterceptor, reLaunch, redirectTo, removeInterceptor, switchTab, uni$1 as uni, upx2px};