87 lines
2.4 KiB
JavaScript
87 lines
2.4 KiB
JavaScript
"use strict";
|
|
const common_vendor = require("../../common/vendor.js");
|
|
if (!Math) {
|
|
TongjiIcon();
|
|
}
|
|
const TongjiIcon = () => "./TongjiIcon.js";
|
|
const _sfc_main = {
|
|
__name: "CelebrateBurst",
|
|
props: {
|
|
show: { type: Boolean, default: false },
|
|
title: { type: String, default: "" },
|
|
subtitle: { type: String, default: "" }
|
|
},
|
|
setup(__props) {
|
|
const props = __props;
|
|
const particles = common_vendor.ref([]);
|
|
const cardPop = common_vendor.ref(false);
|
|
const COLORS = ["#204E2B", "#386641", "#AFE2B3", "#FBBF24", "#727970", "#DC2626"];
|
|
function buildParticles() {
|
|
const list = [];
|
|
for (let i = 0; i < 18; i++) {
|
|
const left = 8 + Math.random() * 84;
|
|
const delay = Math.random() * 0.35;
|
|
const hue = COLORS[i % COLORS.length];
|
|
const size = 10 + Math.floor(Math.random() * 14);
|
|
list.push({
|
|
id: `${Date.now()}_${i}`,
|
|
style: {
|
|
left: `${left}%`,
|
|
width: `${size}rpx`,
|
|
height: `${size}rpx`,
|
|
background: hue,
|
|
animationDelay: `${delay}s`
|
|
}
|
|
});
|
|
}
|
|
return list;
|
|
}
|
|
common_vendor.watch(
|
|
() => props.show,
|
|
(v) => {
|
|
if (v) {
|
|
particles.value = buildParticles();
|
|
cardPop.value = false;
|
|
setTimeout(() => {
|
|
cardPop.value = true;
|
|
}, 30);
|
|
} else {
|
|
particles.value = [];
|
|
cardPop.value = false;
|
|
}
|
|
}
|
|
);
|
|
return (_ctx, _cache) => {
|
|
return common_vendor.e({
|
|
a: __props.show
|
|
}, __props.show ? common_vendor.e({
|
|
b: common_vendor.f(particles.value, (p, k0, i0) => {
|
|
return {
|
|
a: p.id,
|
|
b: common_vendor.s(p.style)
|
|
};
|
|
}),
|
|
c: __props.title
|
|
}, __props.title ? common_vendor.e({
|
|
d: common_vendor.p({
|
|
name: "sparkles",
|
|
size: "lg",
|
|
color: "#204E2B"
|
|
}),
|
|
e: common_vendor.t(__props.title),
|
|
f: __props.subtitle
|
|
}, __props.subtitle ? {
|
|
g: common_vendor.t(__props.subtitle)
|
|
} : {}, {
|
|
h: cardPop.value ? 1 : ""
|
|
}) : {}, {
|
|
i: common_vendor.o(() => {
|
|
}, "49")
|
|
}) : {});
|
|
};
|
|
}
|
|
};
|
|
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-313f45d6"]]);
|
|
wx.createComponent(Component);
|
|
//# sourceMappingURL=../../../.sourcemap/mp-weixin/tongji/components/CelebrateBurst.js.map
|