提交 a7aebfd1 编写于 作者: fxy060608's avatar fxy060608

chore: merge

......@@ -1629,7 +1629,7 @@ function getTempCanvas(width = 0, height = 0) {
tempCanvas.height = height;
return tempCanvas;
}
const props$p = {
const props$q = {
canvasId: {
type: String,
default: ""
......@@ -1649,7 +1649,7 @@ var index$B = /* @__PURE__ */ defineBuiltInComponent({
compatConfig: {
MODE: 3
},
props: props$p,
props: props$q,
computed: {
id() {
return this.canvasId;
......@@ -2107,7 +2107,7 @@ function useMethods(props2, canvasRef, actionsWaiting) {
});
}
const uniCheckGroupKey = PolySymbol(process.env.NODE_ENV !== "production" ? "uniCheckGroup" : "ucg");
const props$o = {
const props$p = {
name: {
type: String,
default: ""
......@@ -2115,7 +2115,7 @@ const props$o = {
};
var index$A = /* @__PURE__ */ defineBuiltInComponent({
name: "CheckboxGroup",
props: props$o,
props: props$p,
emits: ["change"],
setup(props2, {
emit: emit2,
......@@ -2167,7 +2167,7 @@ function useProvideCheckGroup(props2, trigger) {
}
return getFieldsValue;
}
const props$n = {
const props$o = {
checked: {
type: [Boolean, String],
default: false
......@@ -2191,7 +2191,7 @@ const props$n = {
};
var index$z = /* @__PURE__ */ defineBuiltInComponent({
name: "Checkbox",
props: props$n,
props: props$o,
setup(props2, {
slots
}) {
......@@ -2258,7 +2258,7 @@ function useCheckboxInject(checkboxChecked, checkboxValue, reset) {
let resetTimer;
function iosHideKeyboard() {
}
const props$m = {
const props$n = {
cursorSpacing: {
type: [Number, String],
default: 0
......@@ -2430,7 +2430,7 @@ function useQuill(props2, rootRef, trigger) {
useContextInfo();
useSubscribe();
}
const props$l = /* @__PURE__ */ shared.extend({}, props$m, {
const props$m = /* @__PURE__ */ shared.extend({}, props$n, {
id: {
type: String,
default: ""
......@@ -2458,7 +2458,7 @@ const props$l = /* @__PURE__ */ shared.extend({}, props$m, {
});
var index$y = /* @__PURE__ */ defineBuiltInComponent({
name: "Editor",
props: props$l,
props: props$m,
emit: ["ready", "focus", "blur", "input", "statuschange", ...emit$1],
setup(props2, {
emit: emit2
......@@ -2544,7 +2544,7 @@ var index$x = /* @__PURE__ */ defineBuiltInComponent({
};
}
});
const props$k = {
const props$l = {
src: {
type: String,
default: ""
......@@ -2583,7 +2583,7 @@ const IMAGE_MODES = {
};
var index$w = /* @__PURE__ */ defineBuiltInComponent({
name: "Image",
props: props$k,
props: props$l,
setup(props2, {
emit: emit2
}) {
......@@ -2835,7 +2835,7 @@ function getValueString(value, type) {
}
return value === null ? "" : String(value);
}
const props$j = /* @__PURE__ */ shared.extend({}, {
const props$k = /* @__PURE__ */ shared.extend({}, {
name: {
type: String,
default: ""
......@@ -2904,7 +2904,7 @@ const props$j = /* @__PURE__ */ shared.extend({}, {
type: Boolean,
default: false
}
}, props$m);
}, props$n);
const emit = [
"input",
"focus",
......@@ -3099,7 +3099,7 @@ function useField(props2, rootRef, emit2, beforeInput) {
trigger
};
}
const props$i = /* @__PURE__ */ shared.extend({}, props$j, {
const props$j = /* @__PURE__ */ shared.extend({}, props$k, {
placeholderClass: {
type: String,
default: "input-placeholder"
......@@ -3111,7 +3111,7 @@ const props$i = /* @__PURE__ */ shared.extend({}, props$j, {
});
var Input = /* @__PURE__ */ defineBuiltInComponent({
name: "Input",
props: props$i,
props: props$j,
emits: ["confirm", ...emit],
setup(props2, {
emit: emit2
......@@ -4695,7 +4695,7 @@ function _activeAnimation(state, props2) {
}
}
const uniRadioGroupKey = PolySymbol(process.env.NODE_ENV !== "production" ? "uniCheckGroup" : "ucg");
const props$h = {
const props$i = {
name: {
type: String,
default: ""
......@@ -4703,7 +4703,7 @@ const props$h = {
};
var index$r = /* @__PURE__ */ defineBuiltInComponent({
name: "RadioGroup",
props: props$h,
props: props$i,
setup(props2, {
emit: emit2,
slots
......@@ -4780,7 +4780,7 @@ function useProvideRadioGroup(props2, trigger) {
}
return fields2;
}
const props$g = {
const props$h = {
checked: {
type: [Boolean, String],
default: false
......@@ -4804,7 +4804,7 @@ const props$g = {
};
var index$q = /* @__PURE__ */ defineBuiltInComponent({
name: "Radio",
props: props$g,
props: props$h,
setup(props2, {
slots
}) {
......@@ -5124,7 +5124,7 @@ function parseHtml(html) {
});
return results.children;
}
const props$f = {
const props$g = {
nodes: {
type: [Array, String],
default: function() {
......@@ -5137,7 +5137,7 @@ var index$p = /* @__PURE__ */ defineBuiltInComponent({
compatConfig: {
MODE: 3
},
props: props$f,
props: props$g,
emits: ["click", "touchstart", "touchmove", "touchcancel", "touchend", "longpress"],
setup(props2, {
emit: emit2,
......@@ -5168,7 +5168,7 @@ var index$p = /* @__PURE__ */ defineBuiltInComponent({
};
}
});
const props$e = {
const props$f = {
scrollX: {
type: [Boolean, String],
default: false
......@@ -5231,7 +5231,7 @@ var index$o = /* @__PURE__ */ defineBuiltInComponent({
compatConfig: {
MODE: 3
},
props: props$e,
props: props$f,
emits: ["scroll", "scrolltoupper", "scrolltolower", "refresherrefresh", "refresherrestore", "refresherpulling", "refresherabort", "update:refresherTriggered"],
setup(props2, {
emit: emit2,
......@@ -5499,7 +5499,7 @@ function useScrollViewLoader(props2, state, scrollTopNumber, scrollLeftNumber, t
}
});
}
const props$d = {
const props$e = {
name: {
type: String,
default: ""
......@@ -5555,7 +5555,7 @@ const props$d = {
};
var index$n = /* @__PURE__ */ defineBuiltInComponent({
name: "Slider",
props: props$d,
props: props$e,
emits: ["changing", "change"],
setup(props2, {
emit: emit2
......@@ -5717,7 +5717,7 @@ var computeController = {
return Number(s1.replace(".", "")) * Number(s2.replace(".", "")) / Math.pow(10, m);
}
};
const props$c = {
const props$d = {
indicatorDots: {
type: [Boolean, String],
default: false
......@@ -6095,7 +6095,7 @@ function useLayout(props2, state, swiperContexts, slideFrameRef, emit2, trigger)
}
var index$m = /* @__PURE__ */ defineBuiltInComponent({
name: "Swiper",
props: props$c,
props: props$d,
emits: ["change", "transition", "animationfinish", "update:current", "update:currentItemId"],
setup(props2, {
slots,
......@@ -6193,7 +6193,7 @@ var index$m = /* @__PURE__ */ defineBuiltInComponent({
};
}
});
const props$b = {
const props$c = {
itemId: {
type: String,
default: ""
......@@ -6201,7 +6201,7 @@ const props$b = {
};
var index$l = /* @__PURE__ */ defineBuiltInComponent({
name: "SwiperItem",
props: props$b,
props: props$c,
setup(props2, {
slots
}) {
......@@ -6218,7 +6218,7 @@ var index$l = /* @__PURE__ */ defineBuiltInComponent({
};
}
});
const props$a = {
const props$b = {
name: {
type: String,
default: ""
......@@ -6246,7 +6246,7 @@ const props$a = {
};
var index$k = /* @__PURE__ */ defineBuiltInComponent({
name: "Switch",
props: props$a,
props: props$b,
emits: ["change"],
setup(props2, {
emit: emit2
......@@ -6390,7 +6390,7 @@ var index$j = /* @__PURE__ */ defineBuiltInComponent({
};
}
});
const props$9 = /* @__PURE__ */ shared.extend({}, props$j, {
const props$a = /* @__PURE__ */ shared.extend({}, props$k, {
placeholderClass: {
type: String,
default: "input-placeholder"
......@@ -6407,7 +6407,7 @@ const props$9 = /* @__PURE__ */ shared.extend({}, props$j, {
let fixMargin = false;
var index$i = /* @__PURE__ */ defineBuiltInComponent({
name: "Textarea",
props: props$9,
props: props$a,
emit: ["confirm", "linechange", ...emit],
setup(props2, {
emit: emit2
......@@ -7476,7 +7476,7 @@ function useContext(play, pause, seek, sendDanmu, playbackRate, requestFullScree
useContextInfo();
useSubscribe();
}
const props$8 = {
const props$9 = {
id: {
type: String,
default: ""
......@@ -7562,7 +7562,7 @@ const props$8 = {
};
var index$e = /* @__PURE__ */ defineBuiltInComponent({
name: "Video",
props: props$8,
props: props$9,
emits: ["fullscreenchange", "progress", "loadedmetadata", "waiting", "error", "play", "pause", "ended", "timeupdate"],
setup(props2, {
emit: emit2,
......@@ -7783,7 +7783,7 @@ const onWebInvokeAppService = ({ name, arg }) => {
}
};
const Invoke = /* @__PURE__ */ uniShared.once(() => UniServiceJSBridge.on(uniShared.ON_WEB_INVOKE_APP_SERVICE, onWebInvokeAppService));
const props$7 = {
const props$8 = {
src: {
type: String,
default: ""
......@@ -7792,7 +7792,7 @@ const props$7 = {
var index$d = /* @__PURE__ */ defineBuiltInComponent({
inheritAttrs: false,
name: "WebView",
props: props$7,
props: props$8,
setup(props2) {
Invoke();
const rootRef = vue.ref(null);
......@@ -7815,7 +7815,7 @@ var index$d = /* @__PURE__ */ defineBuiltInComponent({
}
});
const ICON_PATH_ORIGIN = "data:image/png;base64,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";
const props$6 = {
const props$7 = {
id: {
type: [Number, String],
default: ""
......@@ -7898,7 +7898,7 @@ function useMarkerLabelStyle(id) {
}
var MapMarker = /* @__PURE__ */ defineSystemComponent({
name: "MapMarker",
props: props$6,
props: props$7,
setup(props2) {
const id = String(Number(props2.id) !== NaN ? props2.id : "");
const onMapReady = vue.inject("onMapReady");
......@@ -8133,7 +8133,7 @@ var MapMarker = /* @__PURE__ */ defineSystemComponent({
};
}
});
const props$5 = {
const props$6 = {
points: {
type: Array,
require: true
......@@ -8179,7 +8179,7 @@ const props$5 = {
};
var MapPolyline = /* @__PURE__ */ defineSystemComponent({
name: "MapPolyline",
props: props$5,
props: props$6,
setup(props2) {
const onMapReady = vue.inject("onMapReady");
let polyline;
......@@ -8231,7 +8231,7 @@ var MapPolyline = /* @__PURE__ */ defineSystemComponent({
};
}
});
const props$4 = {
const props$5 = {
latitude: {
type: [Number, String],
require: true
......@@ -8263,7 +8263,7 @@ const props$4 = {
};
var MapCircle = /* @__PURE__ */ defineSystemComponent({
name: "MapCircle",
props: props$4,
props: props$5,
setup(props2) {
const onMapReady = vue.inject("onMapReady");
let circle;
......@@ -8309,7 +8309,7 @@ var MapCircle = /* @__PURE__ */ defineSystemComponent({
};
}
});
const props$3 = {
const props$4 = {
id: {
type: [Number, String],
default: ""
......@@ -8329,7 +8329,7 @@ const props$3 = {
};
var MapControl = /* @__PURE__ */ defineSystemComponent({
name: "MapControl",
props: props$3,
props: props$4,
setup(props2) {
const onMapReady = vue.inject("onMapReady");
let control;
......@@ -8405,6 +8405,135 @@ var MapLocation = /* @__PURE__ */ defineSystemComponent({
};
}
});
var props$3 = {
dashArray: {
type: Array,
default: () => [0, 0]
},
points: {
type: Array,
required: true
},
strokeWidth: {
type: Number,
default: 1
},
strokeColor: {
type: String,
default: "#000000"
},
fillColor: {
type: String,
default: "#00000000"
},
zIndex: {
type: Number,
default: 0
}
};
function hexToRgba(hex) {
if (!hex) {
return {
r: 0,
g: 0,
b: 0,
a: 0
};
}
let tmpHex = hex.slice(1);
const tmpHexLen = tmpHex.length;
if (![3, 4, 6, 8].includes(tmpHexLen)) {
return {
r: 0,
g: 0,
b: 0,
a: 0
};
}
if (tmpHexLen === 3 || tmpHexLen === 4) {
tmpHex = tmpHex.replace(/(\w{1})/g, "$1$1");
}
let [sr, sg, sb, sa] = tmpHex.match(/(\w{2})/g);
const r = parseInt(sr, 16), g2 = parseInt(sg, 16), b = parseInt(sb, 16);
if (!sa) {
return { r, g: g2, b, a: 1 };
}
return {
r,
g: g2,
b,
a: (`0x100${sa}` - 65536) / 255
};
}
var MapPolygon = defineSystemComponent({
name: "MapPolygon",
props: props$3,
setup(props2) {
let polygonIns;
const onMapReady = vue.inject("onMapReady");
onMapReady((map, maps, trigger) => {
function drawPolygon() {
const {
points,
strokeWidth,
strokeColor,
dashArray,
fillColor,
zIndex
} = props2;
const path = points.map((item) => {
const {
latitude,
longitude
} = item;
return new maps.LatLng(latitude, longitude);
});
const {
r: fcR,
g: fcG,
b: fcB,
a: fcA
} = hexToRgba(fillColor);
const {
r: scR,
g: scG,
b: scB,
a: scA
} = hexToRgba(strokeColor);
const polygonOptions = {
clickable: true,
cursor: "crosshair",
editable: false,
map,
fillColor: "",
path,
strokeColor: "",
strokeDashStyle: dashArray.some((item) => item > 0) ? "dash" : "solid",
strokeWeight: strokeWidth,
visible: true,
zIndex
};
if (maps.Color) {
polygonOptions.fillColor = new maps.Color(fcR, fcG, fcB, fcA);
polygonOptions.strokeColor = new maps.Color(scR, scG, scB, scA);
} else {
polygonOptions.fillColor = `rgb(${fcR}, ${fcG}, ${fcB})`;
polygonOptions.fillOpacity = fcA;
polygonOptions.strokeColor = `rgb(${scR}, ${scG}, ${scB})`;
polygonOptions.strokeOpacity = scA;
}
if (polygonIns) {
polygonIns.setOptions(polygonOptions);
return;
}
polygonIns = new maps.Polygon(polygonOptions);
}
drawPolygon();
vue.watch(props2, drawPolygon);
});
return () => null;
}
});
const props$2 = {
id: {
type: String,
......@@ -8461,6 +8590,10 @@ const props$2 = {
default() {
return [];
}
},
polygons: {
type: Array,
default: () => []
}
};
function getPoints(points) {
......@@ -8656,7 +8789,7 @@ var index$c = /* @__PURE__ */ defineBuiltInComponent({
"style": "width: 100%; height: 100%; position: relative; overflow: hidden"
}, null, 512), props2.markers.map((item) => vue.createVNode(MapMarker, vue.mergeProps({
"key": item.id
}, item), null, 16)), props2.polyline.map((item) => vue.createVNode(MapPolyline, item, null, 16)), props2.circles.map((item) => vue.createVNode(MapCircle, item, null, 16)), props2.controls.map((item) => vue.createVNode(MapControl, item, null, 16)), props2.showLocation && vue.createVNode(MapLocation, null, null), vue.createVNode("div", {
}, item), null, 16)), props2.polyline.map((item) => vue.createVNode(MapPolyline, item, null, 16)), props2.circles.map((item) => vue.createVNode(MapCircle, item, null, 16)), props2.controls.map((item) => vue.createVNode(MapControl, item, null, 16)), props2.showLocation && vue.createVNode(MapLocation, null, null), props2.polygons.map((item) => vue.createVNode(MapPolygon, item, null, 16)), vue.createVNode("div", {
"style": "position: absolute;top: 0;width: 100%;height: 100%;overflow: hidden;pointer-events: none;"
}, [slots.default && slots.default()])], 8, ["id"]);
};
......@@ -10430,40 +10563,6 @@ function createRightWindowTsx(rightWindow, layoutState, windowState) {
}, windowState), null, 16)])], 12, ["data-show"]), [[vue.vShow, layoutState.showRightWindow || layoutState.apiShowRightWindow]]);
}
}
function hexToRgba(hex) {
let r;
let g2;
let b;
hex = hex.replace("#", "");
if (hex.length === 6) {
r = hex.substring(0, 2);
g2 = hex.substring(2, 4);
b = hex.substring(4, 6);
} else if (hex.length === 3) {
r = hex.substring(0, 1);
g2 = hex.substring(1, 2);
b = hex.substring(2, 3);
} else {
return { r: 0, g: 0, b: 0 };
}
if (r.length === 1) {
r += r;
}
if (g2.length === 1) {
g2 += g2;
}
if (b.length === 1) {
b += b;
}
r = parseInt(r, 16);
g2 = parseInt(g2, 16);
b = parseInt(b, 16);
return {
r,
g: g2,
b
};
}
function usePageHeadTransparentBackgroundColor(backgroundColor) {
const { r, g: g2, b } = hexToRgba(backgroundColor);
return `rgba(${r},${g2},${b},0)`;
......
......@@ -6478,7 +6478,7 @@ function getTempCanvas(width = 0, height = 0) {
tempCanvas.height = height;
return tempCanvas;
}
const props$w = {
const props$x = {
canvasId: {
type: String,
default: ""
......@@ -6498,7 +6498,7 @@ var index$w = /* @__PURE__ */ defineBuiltInComponent({
compatConfig: {
MODE: 3
},
props: props$w,
props: props$x,
computed: {
id() {
return this.canvasId;
......@@ -6959,7 +6959,7 @@ function useMethods(props2, canvasRef, actionsWaiting) {
});
}
const uniCheckGroupKey = PolySymbol(process.env.NODE_ENV !== "production" ? "uniCheckGroup" : "ucg");
const props$v = {
const props$w = {
name: {
type: String,
default: ""
......@@ -6967,7 +6967,7 @@ const props$v = {
};
var index$v = /* @__PURE__ */ defineBuiltInComponent({
name: "CheckboxGroup",
props: props$v,
props: props$w,
emits: ["change"],
setup(props2, {
emit: emit2,
......@@ -7019,7 +7019,7 @@ function useProvideCheckGroup(props2, trigger) {
}
return getFieldsValue;
}
const props$u = {
const props$v = {
checked: {
type: [Boolean, String],
default: false
......@@ -7043,7 +7043,7 @@ const props$u = {
};
var index$u = /* @__PURE__ */ defineBuiltInComponent({
name: "Checkbox",
props: props$u,
props: props$v,
setup(props2, {
slots
}) {
......@@ -7120,7 +7120,7 @@ function useCheckboxInject(checkboxChecked, checkboxValue, reset) {
let resetTimer;
function iosHideKeyboard() {
}
const props$t = {
const props$u = {
cursorSpacing: {
type: [Number, String],
default: 0
......@@ -7897,7 +7897,7 @@ function useQuill(props2, rootRef, trigger) {
}
}, id2, true);
}
const props$s = /* @__PURE__ */ extend({}, props$t, {
const props$t = /* @__PURE__ */ extend({}, props$u, {
id: {
type: String,
default: ""
......@@ -7925,7 +7925,7 @@ const props$s = /* @__PURE__ */ extend({}, props$t, {
});
var index$t = /* @__PURE__ */ defineBuiltInComponent({
name: "Editor",
props: props$s,
props: props$t,
emit: ["ready", "focus", "blur", "input", "statuschange", ...emit$1],
setup(props2, {
emit: emit2
......@@ -8012,7 +8012,7 @@ var index$s = /* @__PURE__ */ defineBuiltInComponent({
};
}
});
const props$r = {
const props$s = {
src: {
type: String,
default: ""
......@@ -8051,7 +8051,7 @@ const IMAGE_MODES = {
};
var index$r = /* @__PURE__ */ defineBuiltInComponent({
name: "Image",
props: props$r,
props: props$s,
setup(props2, {
emit: emit2
}) {
......@@ -8368,7 +8368,7 @@ function getValueString(value, type) {
}
return value === null ? "" : String(value);
}
const props$q = /* @__PURE__ */ extend({}, {
const props$r = /* @__PURE__ */ extend({}, {
name: {
type: String,
default: ""
......@@ -8437,7 +8437,7 @@ const props$q = /* @__PURE__ */ extend({}, {
type: Boolean,
default: false
}
}, props$t);
}, props$u);
const emit = [
"input",
"focus",
......@@ -8641,7 +8641,7 @@ function useField(props2, rootRef, emit2, beforeInput) {
trigger
};
}
const props$p = /* @__PURE__ */ extend({}, props$q, {
const props$q = /* @__PURE__ */ extend({}, props$r, {
placeholderClass: {
type: String,
default: "input-placeholder"
......@@ -8653,7 +8653,7 @@ const props$p = /* @__PURE__ */ extend({}, props$q, {
});
var Input = /* @__PURE__ */ defineBuiltInComponent({
name: "Input",
props: props$p,
props: props$q,
emits: ["confirm", ...emit],
setup(props2, {
emit: emit2
......@@ -11343,7 +11343,7 @@ function _activeAnimation(state2, props2) {
}
}
const uniRadioGroupKey = PolySymbol(process.env.NODE_ENV !== "production" ? "uniCheckGroup" : "ucg");
const props$o = {
const props$p = {
name: {
type: String,
default: ""
......@@ -11351,7 +11351,7 @@ const props$o = {
};
var index$o = /* @__PURE__ */ defineBuiltInComponent({
name: "RadioGroup",
props: props$o,
props: props$p,
setup(props2, {
emit: emit2,
slots
......@@ -11434,7 +11434,7 @@ function useProvideRadioGroup(props2, trigger) {
}
return fields2;
}
const props$n = {
const props$o = {
checked: {
type: [Boolean, String],
default: false
......@@ -11458,7 +11458,7 @@ const props$n = {
};
var index$n = /* @__PURE__ */ defineBuiltInComponent({
name: "Radio",
props: props$n,
props: props$o,
setup(props2, {
slots
}) {
......@@ -11788,7 +11788,7 @@ function parseHtml(html) {
});
return results.children;
}
const props$m = {
const props$n = {
nodes: {
type: [Array, String],
default: function() {
......@@ -11801,7 +11801,7 @@ var index$m = /* @__PURE__ */ defineBuiltInComponent({
compatConfig: {
MODE: 3
},
props: props$m,
props: props$n,
emits: ["click", "touchstart", "touchmove", "touchcancel", "touchend", "longpress"],
setup(props2, {
emit: emit2,
......@@ -11836,7 +11836,7 @@ var index$m = /* @__PURE__ */ defineBuiltInComponent({
}
});
const passiveOptions = /* @__PURE__ */ passive(true);
const props$l = {
const props$m = {
scrollX: {
type: [Boolean, String],
default: false
......@@ -11899,7 +11899,7 @@ var ScrollView = /* @__PURE__ */ defineBuiltInComponent({
compatConfig: {
MODE: 3
},
props: props$l,
props: props$m,
emits: ["scroll", "scrolltoupper", "scrolltolower", "refresherrefresh", "refresherrestore", "refresherpulling", "refresherabort", "update:refresherTriggered"],
setup(props2, {
emit: emit2,
......@@ -12318,7 +12318,7 @@ function useScrollViewLoader(props2, state2, scrollTopNumber, scrollLeftNumber,
}
});
}
const props$k = {
const props$l = {
name: {
type: String,
default: ""
......@@ -12374,7 +12374,7 @@ const props$k = {
};
var index$l = /* @__PURE__ */ defineBuiltInComponent({
name: "Slider",
props: props$k,
props: props$l,
emits: ["changing", "change"],
setup(props2, {
emit: emit2
......@@ -12542,7 +12542,7 @@ var computeController = {
return Number(s1.replace(".", "")) * Number(s2.replace(".", "")) / Math.pow(10, m);
}
};
const props$j = {
const props$k = {
indicatorDots: {
type: [Boolean, String],
default: false
......@@ -13026,7 +13026,7 @@ function useLayout(props2, state2, swiperContexts, slideFrameRef, emit2, trigger
}
var Swiper = /* @__PURE__ */ defineBuiltInComponent({
name: "Swiper",
props: props$j,
props: props$k,
emits: ["change", "transition", "animationfinish", "update:current", "update:currentItemId"],
setup(props2, {
slots,
......@@ -13124,7 +13124,7 @@ var Swiper = /* @__PURE__ */ defineBuiltInComponent({
};
}
});
const props$i = {
const props$j = {
itemId: {
type: String,
default: ""
......@@ -13132,7 +13132,7 @@ const props$i = {
};
var SwiperItem = /* @__PURE__ */ defineBuiltInComponent({
name: "SwiperItem",
props: props$i,
props: props$j,
setup(props2, {
slots
}) {
......@@ -13181,7 +13181,7 @@ var SwiperItem = /* @__PURE__ */ defineBuiltInComponent({
};
}
});
const props$h = {
const props$i = {
name: {
type: String,
default: ""
......@@ -13209,7 +13209,7 @@ const props$h = {
};
var index$k = /* @__PURE__ */ defineBuiltInComponent({
name: "Switch",
props: props$h,
props: props$i,
emits: ["change"],
setup(props2, {
emit: emit2
......@@ -13362,7 +13362,7 @@ var index$j = /* @__PURE__ */ defineBuiltInComponent({
};
}
});
const props$g = /* @__PURE__ */ extend({}, props$q, {
const props$h = /* @__PURE__ */ extend({}, props$r, {
placeholderClass: {
type: String,
default: "input-placeholder"
......@@ -13383,7 +13383,7 @@ function setFixMargin() {
}
var index$i = /* @__PURE__ */ defineBuiltInComponent({
name: "Textarea",
props: props$g,
props: props$h,
emit: ["confirm", "linechange", ...emit],
setup(props2, {
emit: emit2
......@@ -14844,7 +14844,7 @@ function useContext(play, pause, seek, sendDanmu, playbackRate, requestFullScree
}
}, id2, true);
}
const props$f = {
const props$g = {
id: {
type: String,
default: ""
......@@ -14930,7 +14930,7 @@ const props$f = {
};
var index$e = /* @__PURE__ */ defineBuiltInComponent({
name: "Video",
props: props$f,
props: props$g,
emits: ["fullscreenchange", "progress", "loadedmetadata", "waiting", "error", "play", "pause", "ended", "timeupdate"],
setup(props2, {
emit: emit2,
......@@ -15151,7 +15151,7 @@ const onWebInvokeAppService = ({ name, arg }) => {
}
};
const Invoke = /* @__PURE__ */ once(() => UniServiceJSBridge.on(ON_WEB_INVOKE_APP_SERVICE, onWebInvokeAppService));
const props$e = {
const props$f = {
src: {
type: String,
default: ""
......@@ -15160,7 +15160,7 @@ const props$e = {
var index$d = /* @__PURE__ */ defineBuiltInComponent({
inheritAttrs: false,
name: "WebView",
props: props$e,
props: props$f,
setup(props2) {
Invoke();
const rootRef = ref(null);
......@@ -15405,7 +15405,7 @@ function loadMaps(libraries, callback) {
document.body.appendChild(script);
}
}
const props$d = {
const props$e = {
id: {
type: [Number, String],
default: ""
......@@ -15491,7 +15491,7 @@ function useMarkerLabelStyle(id2) {
}
var MapMarker = /* @__PURE__ */ defineSystemComponent({
name: "MapMarker",
props: props$d,
props: props$e,
setup(props2) {
const id2 = String(Number(props2.id) !== NaN ? props2.id : "");
const onMapReady = inject("onMapReady");
......@@ -15739,7 +15739,7 @@ var MapMarker = /* @__PURE__ */ defineSystemComponent({
};
}
});
const props$c = {
const props$d = {
points: {
type: Array,
require: true
......@@ -15785,7 +15785,7 @@ const props$c = {
};
var MapPolyline = /* @__PURE__ */ defineSystemComponent({
name: "MapPolyline",
props: props$c,
props: props$d,
setup(props2) {
const onMapReady = inject("onMapReady");
let polyline;
......@@ -15838,7 +15838,7 @@ var MapPolyline = /* @__PURE__ */ defineSystemComponent({
};
}
});
const props$b = {
const props$c = {
latitude: {
type: [Number, String],
require: true
......@@ -15870,7 +15870,7 @@ const props$b = {
};
var MapCircle = /* @__PURE__ */ defineSystemComponent({
name: "MapCircle",
props: props$b,
props: props$c,
setup(props2) {
const onMapReady = inject("onMapReady");
let circle;
......@@ -15917,7 +15917,7 @@ var MapCircle = /* @__PURE__ */ defineSystemComponent({
};
}
});
const props$a = {
const props$b = {
id: {
type: [Number, String],
default: ""
......@@ -15937,7 +15937,7 @@ const props$a = {
};
var MapControl = /* @__PURE__ */ defineSystemComponent({
name: "MapControl",
props: props$a,
props: props$b,
setup(props2) {
const onMapReady = inject("onMapReady");
let control;
......@@ -16512,7 +16512,7 @@ function usePopup(props2, {
});
return visible;
}
const props$9 = {
const props$a = {
title: {
type: String,
default: ""
......@@ -16554,7 +16554,7 @@ const props$9 = {
}
};
var modal = /* @__PURE__ */ defineComponent({
props: props$9,
props: props$a,
setup(props2, {
emit: emit2
}) {
......@@ -17062,7 +17062,7 @@ function usePreventScroll() {
onMounted(() => preventScroll(true));
onUnmounted(() => preventScroll(false));
}
const props$8 = {
const props$9 = {
src: {
type: String,
default: ""
......@@ -17070,7 +17070,7 @@ const props$8 = {
};
var ImageView = /* @__PURE__ */ defineSystemComponent({
name: "ImageView",
props: props$8,
props: props$9,
setup(props2) {
const state2 = reactive({
direction: "none"
......@@ -17160,7 +17160,7 @@ var ImageView = /* @__PURE__ */ defineSystemComponent({
function _isSlot$2(s) {
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
}
const props$7 = {
const props$8 = {
urls: {
type: Array,
default() {
......@@ -17179,7 +17179,7 @@ function getIndex(props2) {
}
var ImagePreview = /* @__PURE__ */ defineSystemComponent({
name: "ImagePreview",
props: props$7,
props: props$8,
emits: ["close"],
setup(props2, {
emit: emit2
......@@ -17931,7 +17931,7 @@ const getLocation = /* @__PURE__ */ defineAsyncApi(API_GET_LOCATION, ({ type, al
});
}, GetLocationProtocol, GetLocationOptions);
const ICON_PATH_NAV = "M28 17c-6.49396875 0-12.13721875 2.57040625-15 6.34840625V5.4105l6.29859375 6.29859375c0.387875 0.387875 1.02259375 0.387875 1.4105 0 0.387875-0.387875 0.387875-1.02259375 0-1.4105L12.77853125 2.36803125a0.9978125 0.9978125 0 0 0-0.0694375-0.077125c-0.1944375-0.1944375-0.45090625-0.291375-0.70721875-0.290875l-0.00184375-0.0000625-0.00184375 0.0000625c-0.2563125-0.0005-0.51278125 0.09640625-0.70721875 0.290875a0.9978125 0.9978125 0 0 0-0.0694375 0.077125l-7.930625 7.9305625c-0.387875 0.387875-0.387875 1.02259375 0 1.4105 0.387875 0.387875 1.02259375 0.387875 1.4105 0L11 5.4105V29c0 0.55 0.45 1 1 1s1-0.45 1-1c0-5.52284375 6.71571875-10 15-10 0.55228125 0 1-0.44771875 1-1 0-0.55228125-0.44771875-1-1-1z";
const props$6 = {
const props$7 = {
latitude: {
type: Number
},
......@@ -17988,7 +17988,7 @@ function useState$2(props2) {
}
var LocationView = /* @__PURE__ */ defineSystemComponent({
name: "LocationView",
props: props$6,
props: props$7,
emits: ["close"],
setup(props2, {
emit: emit2
......@@ -18096,7 +18096,7 @@ const openLocation = /* @__PURE__ */ defineAsyncApi(API_OPEN_LOCATION, (args, {
function _isSlot$1(s) {
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
}
const props$5 = {
const props$6 = {
latitude: {
type: Number
},
......@@ -18242,7 +18242,7 @@ function useList(state2) {
}
var LoctaionPicker = /* @__PURE__ */ defineSystemComponent({
name: "LoctaionPicker",
props: props$5,
props: props$6,
emits: ["close"],
setup(props2, {
emit: emit2
......@@ -18521,7 +18521,7 @@ const preloadPage = /* @__PURE__ */ defineAsyncApi(API_PRELOAD_PAGE, ({ url }, {
reject(`${url} ${String(err)}`);
});
}, PreloadPageProtocol);
const props$4 = {
const props$5 = {
title: {
type: String,
default: ""
......@@ -18551,7 +18551,7 @@ const props$4 = {
const ToastIconClassName = "uni-toast__icon";
var Toast = /* @__PURE__ */ defineComponent({
name: "Toast",
props: props$4,
props: props$5,
setup(props2) {
initI18nShowToastMsgsOnce();
initI18nShowLoadingMsgsOnce();
......@@ -18771,7 +18771,7 @@ function usePopupStyle(props2) {
popupStyle
};
}
const props$3 = {
const props$4 = {
title: {
type: String,
default: ""
......@@ -18801,7 +18801,7 @@ const props$3 = {
};
var actionSheet = /* @__PURE__ */ defineComponent({
name: "ActionSheet",
props: props$3,
props: props$4,
emits: ["close"],
setup(props2, {
emit: emit2
......@@ -20115,6 +20115,138 @@ var MapLocation = /* @__PURE__ */ defineSystemComponent({
};
}
});
var props$3 = {
dashArray: {
type: Array,
default: () => [0, 0]
},
points: {
type: Array,
required: true
},
strokeWidth: {
type: Number,
default: 1
},
strokeColor: {
type: String,
default: "#000000"
},
fillColor: {
type: String,
default: "#00000000"
},
zIndex: {
type: Number,
default: 0
}
};
function hexToRgba(hex) {
if (!hex) {
return {
r: 0,
g: 0,
b: 0,
a: 0
};
}
let tmpHex = hex.slice(1);
const tmpHexLen = tmpHex.length;
if (![3, 4, 6, 8].includes(tmpHexLen)) {
return {
r: 0,
g: 0,
b: 0,
a: 0
};
}
if (tmpHexLen === 3 || tmpHexLen === 4) {
tmpHex = tmpHex.replace(/(\w{1})/g, "$1$1");
}
let [sr, sg, sb, sa] = tmpHex.match(/(\w{2})/g);
const r = parseInt(sr, 16), g2 = parseInt(sg, 16), b = parseInt(sb, 16);
if (!sa) {
return { r, g: g2, b, a: 1 };
}
return {
r,
g: g2,
b,
a: (`0x100${sa}` - 65536) / 255
};
}
var MapPolygon = defineSystemComponent({
name: "MapPolygon",
props: props$3,
setup(props2) {
let polygonIns;
const onMapReady = inject("onMapReady");
onMapReady((map, maps2, trigger) => {
function drawPolygon() {
const {
points,
strokeWidth,
strokeColor,
dashArray,
fillColor,
zIndex
} = props2;
const path = points.map((item) => {
const {
latitude,
longitude
} = item;
return new maps2.LatLng(latitude, longitude);
});
const {
r: fcR,
g: fcG,
b: fcB,
a: fcA
} = hexToRgba(fillColor);
const {
r: scR,
g: scG,
b: scB,
a: scA
} = hexToRgba(strokeColor);
const polygonOptions = {
clickable: true,
cursor: "crosshair",
editable: false,
map,
fillColor: "",
path,
strokeColor: "",
strokeDashStyle: dashArray.some((item) => item > 0) ? "dash" : "solid",
strokeWeight: strokeWidth,
visible: true,
zIndex
};
if (maps2.Color) {
polygonOptions.fillColor = new maps2.Color(fcR, fcG, fcB, fcA);
polygonOptions.strokeColor = new maps2.Color(scR, scG, scB, scA);
} else {
polygonOptions.fillColor = `rgb(${fcR}, ${fcG}, ${fcB})`;
polygonOptions.fillOpacity = fcA;
polygonOptions.strokeColor = `rgb(${scR}, ${scG}, ${scB})`;
polygonOptions.strokeOpacity = scA;
}
if (polygonIns) {
polygonIns.setOptions(polygonOptions);
return;
}
polygonIns = new maps2.Polygon(polygonOptions);
}
drawPolygon();
watch(props2, drawPolygon);
});
onUnmounted(() => {
polygonIns.setMap(null);
});
return () => null;
}
});
const props$2 = {
id: {
type: String,
......@@ -20171,6 +20303,10 @@ const props$2 = {
default() {
return [];
}
},
polygons: {
type: Array,
default: () => []
}
};
function getPoints(points) {
......@@ -20481,7 +20617,7 @@ var Map$1 = /* @__PURE__ */ defineBuiltInComponent({
"style": "width: 100%; height: 100%; position: relative; overflow: hidden"
}, null, 512), props2.markers.map((item) => createVNode(MapMarker, mergeProps({
"key": item.id
}, item), null, 16)), props2.polyline.map((item) => createVNode(MapPolyline, item, null, 16)), props2.circles.map((item) => createVNode(MapCircle, item, null, 16)), props2.controls.map((item) => createVNode(MapControl, item, null, 16)), props2.showLocation && createVNode(MapLocation, null, null), createVNode("div", {
}, item), null, 16)), props2.polyline.map((item) => createVNode(MapPolyline, item, null, 16)), props2.circles.map((item) => createVNode(MapCircle, item, null, 16)), props2.controls.map((item) => createVNode(MapControl, item, null, 16)), props2.showLocation && createVNode(MapLocation, null, null), props2.polygons.map((item) => createVNode(MapPolygon, item, null, 16)), createVNode("div", {
"style": "position: absolute;top: 0;width: 100%;height: 100%;overflow: hidden;pointer-events: none;"
}, [slots.default && slots.default()])], 8, ["id"]);
};
......@@ -21344,40 +21480,6 @@ const UniServiceJSBridge$1 = /* @__PURE__ */ extend(ServiceJSBridge, {
UniViewJSBridge.subscribeHandler(event, args, pageId);
}
});
function hexToRgba(hex) {
let r;
let g2;
let b;
hex = hex.replace("#", "");
if (hex.length === 6) {
r = hex.substring(0, 2);
g2 = hex.substring(2, 4);
b = hex.substring(4, 6);
} else if (hex.length === 3) {
r = hex.substring(0, 1);
g2 = hex.substring(1, 2);
b = hex.substring(2, 3);
} else {
return { r: 0, g: 0, b: 0 };
}
if (r.length === 1) {
r += r;
}
if (g2.length === 1) {
g2 += g2;
}
if (b.length === 1) {
b += b;
}
r = parseInt(r, 16);
g2 = parseInt(g2, 16);
b = parseInt(b, 16);
return {
r,
g: g2,
b
};
}
function usePageHeadTransparentBackgroundColor(backgroundColor) {
const { r, g: g2, b } = hexToRgba(backgroundColor);
return `rgba(${r},${g2},${b},0)`;
......
export function hexToRgba(hex: string) {
let r
let g
let b
hex = hex.replace('#', '')
if (hex.length === 6) {
r = hex.substring(0, 2)
g = hex.substring(2, 4)
b = hex.substring(4, 6)
} else if (hex.length === 3) {
r = hex.substring(0, 1)
g = hex.substring(1, 2)
b = hex.substring(2, 3)
} else {
return { r: 0, g: 0, b: 0 }
/**
* 从 16 进制的色值解析成 rgba 格式的色值
* @param { string } hex, #000、#000A、#000000、#000000AA,参数只能是这四种格式
*/
export function hexToRgba(hex: string): RGBA {
// 异常情况
if (!hex) {
return {
r: 0,
g: 0,
b: 0,
a: 0,
}
}
if (r.length === 1) {
r += r
// 去掉 #
let tmpHex = hex.slice(1)
const tmpHexLen = tmpHex.length
// 处理 16 进制色值位数异常的情况
if (![3, 4, 6, 8].includes(tmpHexLen)) {
return {
r: 0,
g: 0,
b: 0,
a: 0,
}
}
if (g.length === 1) {
g += g
// 格式化 tmpHex,使其变成 rrggbb 或 rrggbbaa
if (tmpHexLen === 3 || tmpHexLen === 4) {
// rgb => rrggbb || rgba => rrggbbaa
tmpHex = tmpHex.replace(/(\w{1})/g, '$1$1')
}
if (b.length === 1) {
b += b
// rgba
let [sr, sg, sb, sa] = tmpHex.match(/(\w{2})/g) as string[]
// rgb
const r = parseInt(sr, 16),
g = parseInt(sg, 16),
b = parseInt(sb, 16)
if (!sa) {
return { r, g, b, a: 1 }
}
r = parseInt(r, 16)
g = parseInt(g, 16)
b = parseInt(b, 16)
return {
r,
g,
b,
a: ((`0x100${sa}` as unknown as number) - 0x10000) / 255,
}
}
export interface RGBA {
r: number
g: number
b: number
a: number
}
......@@ -29,6 +29,8 @@ import MapLocation, {
Context as MapLocationContext,
CONTEXT_ID as MAP_LOCATION_CONTEXT_ID,
} from './MapLocation'
import MapPolygon from './map-polygon/index'
import { Polygon } from './map-polygon/interface'
const props = {
id: {
......@@ -87,6 +89,10 @@ const props = {
return []
},
},
polygons: {
type: Array as PropType<Polygon[]>,
default: () => [],
},
}
type Props = Record<keyof typeof props, any>
......@@ -476,6 +482,9 @@ export default /*#__PURE__*/ defineBuiltInComponent({
<MapControl {...item} />
))}
{props.showLocation && <MapLocation />}
{props.polygons.map((item) => (
<MapPolygon {...item} />
))}
<div style="position: absolute;top: 0;width: 100%;height: 100%;overflow: hidden;pointer-events: none;">
{slots.default && slots.default()}
</div>
......
import { inject, watch, onUnmounted } from 'vue'
import { defineSystemComponent } from '@dcloudio/uni-components'
import props from './props'
import {
OnMapReady,
Polygon,
Props,
Point,
CustomEventTrigger,
PolygonOptions,
} from './interface'
import { Map, Maps } from '../maps'
import { QQMaps } from '../maps/qq/types'
import { hexToRgba } from '../../../../helpers/hexToRgba'
export default defineSystemComponent({
name: 'MapPolygon',
props,
setup(props: Props) {
// polygon 实例
let polygonIns: Polygon
// 当地图准备好以后调用指定的回调函数
const onMapReady = inject<OnMapReady>('onMapReady') as OnMapReady
onMapReady((map: Map, maps: Maps, trigger: CustomEventTrigger) => {
// 绘制区域
function drawPolygon() {
const {
points,
strokeWidth,
strokeColor,
dashArray,
fillColor,
zIndex,
} = props
const path = points.map((item: Point) => {
const { latitude, longitude } = item
return new maps.LatLng(latitude, longitude)
})
const { r: fcR, g: fcG, b: fcB, a: fcA } = hexToRgba(fillColor)
const { r: scR, g: scG, b: scB, a: scA } = hexToRgba(strokeColor)
const polygonOptions: PolygonOptions = {
//多边形是否可点击。
clickable: true,
//鼠标在多边形内的光标样式。
cursor: 'crosshair',
//多边形是否可编辑。
editable: false,
// 地图实例,即要显示多边形的地图
// @ts-ignore
map,
// 区域填充色
fillColor: '',
//多边形的路径,以经纬度坐标数组构成。
path,
// 区域边框
strokeColor: '',
//多边形的边框样式。实线是solid,虚线是dash。
strokeDashStyle: dashArray.some((item: number) => item > 0)
? 'dash'
: 'solid',
//多边形的边框线宽。
strokeWeight: strokeWidth,
//多边形是否可见。
visible: true,
//多边形的zIndex值。
zIndex: zIndex,
}
// 多边形的填充色、边框以及相应的透明度
if ((maps as QQMaps).Color) {
// 说明是 腾讯地图,google map 实例没有 Color 属性
// 将类型转为两者共有的 string,避免 ts 报错
polygonOptions.fillColor = new (maps as QQMaps).Color(
fcR,
fcG,
fcB,
fcA
) as unknown as string
polygonOptions.strokeColor = new (maps as QQMaps).Color(
scR,
scG,
scB,
scA
) as unknown as string
} else {
// google map
polygonOptions.fillColor = `rgb(${fcR}, ${fcG}, ${fcB})`
polygonOptions.fillOpacity = fcA
polygonOptions.strokeColor = `rgb(${scR}, ${scG}, ${scB})`
polygonOptions.strokeOpacity = scA
}
if (polygonIns) {
// 更新区域属性
polygonIns.setOptions(polygonOptions)
return
}
// 说明是新增区域
polygonIns = new maps.Polygon(polygonOptions)
}
// 给地图添加区域
drawPolygon()
// 监听 props
watch(props, drawPolygon)
})
onUnmounted(() => {
// 卸载时清除地图上绘制的 polygon
polygonIns.setMap(null)
})
return () => null
},
})
import { Maps, Map } from '../maps'
import {
Polygon as QQPolygon,
PolygonOptions as QQPolygonOptions,
} from '../maps/qq/types'
import { Polygon as GPolygon } from '../maps/google/types'
import { useCustomEvent } from '@dcloudio/uni-components'
import props from './props'
export interface Point {
latitude: number
longitude: number
}
export type CustomEventTrigger = ReturnType<typeof useCustomEvent>
type OnMapReadyCallback = (
map: Map,
maps: Maps,
trigger: CustomEventTrigger
) => void
export type OnMapReady = (callback: OnMapReadyCallback) => void
export type Polygon = QQPolygon | GPolygon
export type PolygonOptions = QQPolygonOptions & google.maps.PolygonOptions
export type Props = Record<keyof typeof props, any>
export interface EventObj {
[key: string]: string
}
import { PropType } from 'vue'
import { Point } from './interface'
// MapPolygon 组件的 props 属性配置
export default {
// 边框虚线,腾讯地图支持,google 地图不支持,默认值为[0, 0] 为实线,非 [0, 0] 为虚线,H5 端无法像微信小程序一样控制虚线的间隔像素大小
dashArray: {
type: Array as PropType<number[]>,
default: () => [0, 0],
},
// 经纬度数组,[{latitude: 0, longitude: 0}]
points: {
type: Array as PropType<Point[]>,
required: true,
},
// 描边的宽度
strokeWidth: {
type: Number,
default: 1,
},
// 描边的颜色,十六进制
strokeColor: {
type: String,
default: '#000000',
},
// 填充颜色,十六进制
fillColor: {
type: String,
default: '#00000000',
},
// 设置多边形 Z 轴数值
zIndex: {
type: Number,
default: 0,
},
}
......@@ -8,3 +8,5 @@ export type Marker = google.maps.Marker
export type Label = google.maps.MarkerLabel
export type Circle = google.maps.Circle
export type Icon = google.maps.Icon
export type Polygon = google.maps.Polygon
export type Polygon = google.maps.PolygonOptions
......@@ -1330,4 +1330,60 @@ export interface QQMaps {
Color: typeof Color
Circle: typeof Circle
geometry: Geometry
Polygon: typeof Polygon
}
export interface PolygonOptions {
// 多边形是否可点击
clickable: boolean
// 鼠标在多边形内的光标样式
cursor: string
// true - 启动编辑功能,
// false - 默认,不启动编辑功能,
// 启动编辑功能后,可拖动端点对形状进行调整,双击节点可删除
editable?: boolean
// 多边形的填充色,可通过Color对象的alpha属性设置透明度
fillColor: Color | string
// google map 支持,fillColor 的透明度
fillOpacity?: number
// 要显示多边形的地图。
map: Map
// 多边形轮廓的坐标数组。若为环多边形,设置为二维数组,第一个元素为外多边形,其他元素为内部“孤岛”轮廓
path: Array<LatLng> | Array<Array<LatLng>>
// 多边形的线条颜色,可通过Color对象的alpha属性设置透明度
strokeColor: Color | string
// google map 支持,strokeColor 的透明度
strokeOpacity?: number
// 多边形的边框样式。实线是solid,虚线是dash
strokeDashStyle: string
// 多边形的边框线宽
strokeWeight: number
// 多边形是否可见
visible: boolean
// 多边形的zIndex值
zIndex: number
}
export class Polygon {
constructor(options: PolygonOptions)
// 返回多边形的地理区域范围
getBounds(): LatLngBounds
// 返回多边形所在的map对象
getMap(): Map
// 获取多边形的经纬度坐标数组。
getPath(): MVCArray<LatLng>
// 获取多边形覆盖物的可见性
getVisible(): boolean
// 获取多边形覆盖物的zIndex值
getZIndex(): number
// 设置多边形所在的map对象
setMap(map: Map | null): void
// 设置多边形轮廓的经纬度坐标数组,若为二维数组则表现为环多边形
setPath(path: Array<LatLng> | Array<Array<LatLng>>): void
// 设置多边形的可见性
setVisible(visible: boolean): void
// 设置多变心覆盖物的zIndex
setZIndex(zIndex: number): void
// 设置多边形参数
setOptions(options: PolygonOptions): void
}
......@@ -1098,6 +1098,12 @@ function handleLink({ detail: { vuePid, nodeId, webviewId }, }) {
initProvide(vm);
}
vm.$callCreatedHook();
// TODO 字节小程序父子组件关系建立的较晚,导致 inject 和 provide 初始化变慢
// 由此引发在 setup 中暂不可用,只能通过 options 方式配置
// 初始化完 inject 后,再次调用 update,触发一次更新
if (vm.$options.inject) {
vm.$.update();
}
nextSetDataTick(this, () => {
vm.$callHook('mounted');
vm.$callHook(ON_READY$1);
......
......@@ -1119,6 +1119,12 @@ function handleLink({ detail: { vuePid, nodeId, webviewId }, }) {
initProvide(vm);
}
vm.$callCreatedHook();
// TODO 字节小程序父子组件关系建立的较晚,导致 inject 和 provide 初始化变慢
// 由此引发在 setup 中暂不可用,只能通过 options 方式配置
// 初始化完 inject 后,再次调用 update,触发一次更新
if (vm.$options.inject) {
vm.$.update();
}
nextSetDataTick(this, () => {
vm.$callHook('mounted');
vm.$callHook(ON_READY$1);
......
......@@ -81,8 +81,13 @@ export function handleLink(
initInjections(vm)
initProvide(vm)
}
vm.$callCreatedHook()
// TODO 字节小程序父子组件关系建立的较晚,导致 inject 和 provide 初始化变慢
// 由此引发在 setup 中暂不可用,只能通过 options 方式配置
// 初始化完 inject 后,再次调用 update,触发一次更新
if (vm.$options.inject) {
vm.$.update()
}
nextSetDataTick(this, () => {
vm.$callHook('mounted')
vm.$callHook(ON_READY)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册