mine-h5-ui
Version:
一款轻量级、模块化基于 Vue3.x 的 H5 前端 UI 组件库 👍
69 lines (68 loc) • 2.17 kB
JavaScript
import { defineComponent as M, mergeModels as f, useModel as b, createElementBlock as p, openBlock as y, createElementVNode as l, normalizeStyle as n, unref as e, withModifiers as g, renderSlot as T } from "vue";
import { useHandler as V } from "./hooks.js";
/*!
* mine-h5-ui v2.15.0
* Copyright (c) 2025 biaov
* @license MIT
*/
const $ = ["data-disabled"], k = {
key: 0,
class: "round"
}, E = /* @__PURE__ */ M({
name: "MeSlider",
__name: "index",
props: /* @__PURE__ */ f({
max: { default: 100 },
min: { default: 0 },
styles: { default: () => ({
height: "",
radius: "",
lineBgc: ""
}) },
disabled: { type: Boolean, default: !1 },
isBtn: { type: Boolean, default: !1 }
}, {
modelValue: { default: 0 },
modelModifiers: {}
}),
emits: /* @__PURE__ */ f(["start", "move", "end"], ["update:modelValue"]),
setup(d, { emit: h }) {
const B = h, c = d, v = b(d, "modelValue"), { currentValue: a, onTouchstart: r, onTouchmove: i, onTouchend: u, onMousedown: m } = V({ props: c, emit: B, modelValue: v });
return (t, o) => (y(), p("div", {
class: "me-slider",
"data-disabled": t.disabled
}, [
l("p", {
class: "line",
style: n(`height:${t.styles.height};border-radius:${t.styles.radius};`)
}, [
l("span", {
style: n(`background:${t.styles.lineBgc};transform:translateX(-${e(a)}%);`)
}, null, 4)
], 4),
l("div", {
class: "drag",
style: n(`left:${100 - e(a)}%;`),
onTouchstart: o[0] || (o[0] = g(
//@ts-ignore
(...s) => e(r) && e(r)(...s),
["prevent"]
)),
onTouchmove: o[1] || (o[1] = //@ts-ignore
(...s) => e(i) && e(i)(...s)),
onTouchend: o[2] || (o[2] = //@ts-ignore
(...s) => e(u) && e(u)(...s)),
onMousedown: o[3] || (o[3] = g(
//@ts-ignore
(...s) => e(m) && e(m)(...s),
["prevent"]
))
}, [
t.isBtn ? T(t.$slots, "default", { key: 1 }) : (y(), p("span", k))
], 36)
], 8, $));
}
});
export {
E as default
};