@cqmcui/cqmcui
Version:
轻量级移动端 Vue2、Vue3 组件库(支持小程序开发)
105 lines (104 loc) • 3.98 kB
JavaScript
import { inject, reactive, ref, useSlots, toRefs, resolveComponent, openBlock, createElementBlock, createBlock, withCtx, createTextVNode, toDisplayString, createCommentVNode, renderSlot } from "vue";
import { c as createComponent } from "./component-81a4c1d0.js";
import Button from "./Button.js";
import { _ as _export_sfc } from "./_plugin-vue_export-helper-cc2b3d55.js";
import "../locale/lang";
import "@cqmcui/icons-vue";
const { componentName, create, translate } = createComponent("audio-operate");
const _sfc_main = create({
props: {
// 展示的形式 back 倒退 play 开始 or 暂停 forward 快进 mute 静音
type: {
type: String,
default: () => "play"
}
},
components: {
[Button.name]: Button
},
emits: ["click"],
setup(props, { emit }) {
const audio = inject("audioParent");
const parent = reactive(audio);
const customSlot = ref(useSlots().default);
return { ...toRefs(props), ...toRefs(parent), customSlot, translate };
}
});
const _hoisted_1 = { class: "cqmc-audio-operate" };
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
const _component_nut_button = resolveComponent("cqmc-button");
return openBlock(), createElementBlock("div", _hoisted_1, [
_ctx.type == "back" ? (openBlock(), createElementBlock("div", {
key: 0,
class: "cqmc-audio-operate-item",
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.fastBack && _ctx.fastBack(...args))
}, [
!_ctx.customSlot ? (openBlock(), createBlock(_component_nut_button, {
key: 0,
type: "primary",
size: "small"
}, {
default: withCtx(() => [
createTextVNode(toDisplayString(_ctx.translate("back")), 1)
]),
_: 1
})) : createCommentVNode("", true),
renderSlot(_ctx.$slots, "default")
])) : createCommentVNode("", true),
_ctx.type == "play" ? (openBlock(), createElementBlock("div", {
key: 1,
class: "cqmc-audio-operate-item",
onClick: _cache[1] || (_cache[1] = (...args) => _ctx.changeStatus && _ctx.changeStatus(...args))
}, [
!_ctx.customSlot ? (openBlock(), createBlock(_component_nut_button, {
key: 0,
type: "primary",
size: "small"
}, {
default: withCtx(() => [
createTextVNode(toDisplayString(!_ctx.audioData.playing ? `${_ctx.translate("start")}` : `${_ctx.translate("pause")}`), 1)
]),
_: 1
})) : createCommentVNode("", true),
renderSlot(_ctx.$slots, "default")
])) : createCommentVNode("", true),
_ctx.type == "forward" ? (openBlock(), createElementBlock("div", {
key: 2,
class: "cqmc-audio-operate-item",
onClick: _cache[2] || (_cache[2] = (...args) => _ctx.forward && _ctx.forward(...args))
}, [
!_ctx.customSlot ? (openBlock(), createBlock(_component_nut_button, {
key: 0,
type: "primary",
size: "small"
}, {
default: withCtx(() => [
createTextVNode("快进")
]),
_: 1
})) : createCommentVNode("", true),
renderSlot(_ctx.$slots, "default")
])) : createCommentVNode("", true),
_ctx.type == "mute" ? (openBlock(), createElementBlock("div", {
key: 3,
class: "cqmc-audio-operate-item",
onClick: _cache[3] || (_cache[3] = (...args) => _ctx.handleMute && _ctx.handleMute(...args))
}, [
!_ctx.customSlot ? (openBlock(), createBlock(_component_nut_button, {
key: 0,
type: !_ctx.audioData.hanMuted ? "primary" : "default",
size: "small"
}, {
default: withCtx(() => [
createTextVNode(toDisplayString(_ctx.translate("mute")), 1)
]),
_: 1
}, 8, ["type"])) : createCommentVNode("", true),
renderSlot(_ctx.$slots, "default")
])) : createCommentVNode("", true)
]);
}
const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
export {
index as default
};