mine-h5-ui
Version:
一款轻量级、模块化基于 Vue3.x 的 H5 前端 UI 组件库 👍
51 lines (50 loc) • 2.03 kB
JavaScript
import { defineComponent as B, useModel as $, openBlock as m, createElementBlock as k, createElementVNode as u, withModifiers as i, unref as e, normalizeStyle as f, createBlock as w, createCommentVNode as S, createTextVNode as N, toDisplayString as g, renderSlot as C, mergeModels as c } from "vue";
import E from "../MeLoading/index.vue.js";
import { useHandMove as I } from "./hooks.js";
const Y = { class: "me-pull-refresh" }, P = /* @__PURE__ */ B({
name: "MePullRefresh",
__name: "index",
props: /* @__PURE__ */ c({
loadText: { default: () => ["下拉即可刷新...", "释放即可刷新...", "加载中...", "刷新成功"] },
loadIcon: { type: Boolean, default: !0 }
}, {
modelValue: { type: Boolean, default: !1 },
modelModifiers: {}
}),
emits: /* @__PURE__ */ c(["refresh"], ["update:modelValue"]),
setup(n, { emit: p }) {
const v = p, T = $(n, "modelValue"), { activeState: l, transY: M, scale: V, showValue: y, duration: h, onTouchstart: r, onTouchmove: s, onTouchend: a, onMousedown: d } = I({ emit: v, modelValue: T });
return (x, o) => (m(), k("div", Y, [
u("div", {
class: "cont",
style: f(`transform: translateY(${e(M) - e(y)}px);transition-duration: ${e(h)}ms;`),
onTouchstart: o[0] || (o[0] = i(
//@ts-ignore
(...t) => e(r) && e(r)(...t),
["prevent"]
)),
onTouchmove: o[1] || (o[1] = //@ts-ignore
(...t) => e(s) && e(s)(...t)),
onTouchend: o[2] || (o[2] = //@ts-ignore
(...t) => e(a) && e(a)(...t)),
onMousedown: o[3] || (o[3] = i(
//@ts-ignore
(...t) => e(d) && e(d)(...t),
["prevent"]
))
}, [
u("div", {
class: "hd",
style: f(`transform:scale(${e(V)});`)
}, [
n.loadIcon && e(l) === 2 ? (m(), w(E, { key: 0 })) : S("", !0),
N(" " + g(n.loadText[e(l)]), 1)
], 4),
C(x.$slots, "default")
], 36)
]));
}
});
export {
P as default
};