UNPKG

various-ui

Version:

This is a test version of the Vue 3 component library

117 lines (112 loc) 4.6 kB
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var vue = require('vue'); var index = require('./index.js'); var composable = require('./src/composable.js'); var index$1 = require('../../icon/index.js'); const _hoisted_1 = { key: 2, class: "ui-carousel-schedules" }; const _hoisted_2 = ["onClick"]; const __default__ = vue.defineComponent({ name: "UiCarousel" }); var _sfc_main = /* @__PURE__ */ vue.defineComponent({ ...__default__, props: index.UiCarouselPropsOption, emits: index.UiCarouselEmits, setup(__props, { expose: __expose, emit: __emit }) { const define = __props; const emits = __emit; const { ons, refs, watchs, methods, computeds, variable } = composable.useComposable(define, emits); const { main, active, container, childrens } = refs; const { switchCarousel, switchBack, switchNext, init } = methods; const { style, className, isLastControl, isFirstControl } = computeds; vue.onMounted(() => { variable.observer = new ResizeObserver(() => methods.init()); if (main.value) { variable.observer.observe(main.value); } }); vue.onBeforeUnmount(() => { variable.observer && variable.observer.disconnect(); refs.autoTimer.value && clearInterval(refs.autoTimer.value); watchs.stopAutoPlay && watchs.stopAutoPlay(); }); ; __expose({ init, switchBack, switchNext, switchCarousel }); return (_ctx, _cache) => { return vue.openBlock(), vue.createElementBlock( "div", vue.mergeProps({ class: ["ui-carousel", vue.unref(className)], style: vue.unref(style) }, vue.toHandlers(vue.unref(ons).main, true)), [ vue.createCommentVNode(" \u8F6E\u64AD\u56FE\u5BB9\u5668, \u7528\u6765\u63A7\u5236\u8F6E\u64AD\u6EDA\u52A8 "), vue.createElementVNode( "div", { class: "ui-carousel-main", ref_key: "main", ref: main }, [ vue.createElementVNode( "div", vue.mergeProps({ class: "ui-carousel-container", ref_key: "container", ref: container }, vue.toHandlers(vue.unref(ons).container, true)), [ vue.renderSlot(_ctx.$slots, "default") ], 16 /* FULL_PROPS */ ) ], 512 /* NEED_PATCH */ ), vue.createCommentVNode(" \u8F6E\u64AD\u56FE\u5DE6\u4FA7\u7BAD\u5934 "), vue.unref(isFirstControl) ? vue.renderSlot(_ctx.$slots, "arrow-back", { key: 0 }, () => [ vue.createElementVNode("div", { class: "ui-carousel-control ui-carousel-left-control", onClick: _cache[0] || (_cache[0] = ($event) => vue.unref(switchCarousel)(vue.unref(active) - 1)) }, [ vue.createVNode(vue.unref(index$1.UiIcon), { name: "arrow" }) ]) ]) : vue.createCommentVNode("v-if", true), vue.createCommentVNode(" \u8F6E\u64AD\u56FE\u53F3\u4FA7\u7BAD\u5934 "), vue.unref(isLastControl) ? vue.renderSlot(_ctx.$slots, "arrow-next", { key: 1 }, () => [ vue.createElementVNode("div", { class: "ui-carousel-control ui-carousel-right-control", onClick: _cache[1] || (_cache[1] = ($event) => vue.unref(switchCarousel)(vue.unref(active) + 1)) }, [ vue.createVNode(vue.unref(index$1.UiIcon), { name: "arrow" }) ]) ]) : vue.createCommentVNode("v-if", true), vue.createCommentVNode(" \u8F6E\u64AD\u56FE\u5206\u9875\u5668 "), _ctx.pagination ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [ (vue.openBlock(true), vue.createElementBlock( vue.Fragment, null, vue.renderList(vue.unref(childrens), (value, index) => { return vue.openBlock(), vue.createElementBlock("div", { class: vue.normalizeClass(["ui-carousel-schedule", { active: index == vue.unref(active) }]), onClick: ($event) => vue.unref(switchCarousel)(index, value) }, null, 10, _hoisted_2); }), 256 /* UNKEYED_FRAGMENT */ )) ])) : vue.createCommentVNode("v-if", true) ], 16 /* FULL_PROPS */ ); }; } }); exports.default = _sfc_main; //# sourceMappingURL=index.vue2.js.map