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