UNPKG

winbox-ui-next

Version:

We Design Vue 2.0: A Vue.js 3 UI Library

67 lines (66 loc) 2.14 kB
"use strict"; var vue = require("vue"); var iconHover = require("../_components/icon-hover.js"); var index$1 = require("../icon/icon-left/index.js"); var index = require("../icon/icon-right/index.js"); var index$3 = require("../icon/icon-up/index.js"); var index$2 = require("../icon/icon-down/index.js"); var globalConfig = require("../_utils/global-config.js"); function _isSlot(s) { return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s); } var TabsButton = vue.defineComponent({ name: "TabsButton", props: { type: { type: String, default: "next" }, direction: { type: String, default: "horizontal" }, onClick: { type: Function, required: true }, disabled: { type: Boolean, default: false } }, setup(props) { const prefixCls = globalConfig.getPrefixCls("tabs-nav-button"); const renderIcon = () => { if (props.direction === "horizontal") { if (props.type === "next") { return vue.createVNode(index, null, null); } return vue.createVNode(index$1, null, null); } if (props.type === "next") { return vue.createVNode(index$2, null, null); } return vue.createVNode(index$3, null, null); }; const cls = vue.computed(() => [prefixCls, { [`${prefixCls}-disabled`]: props.disabled, [`${prefixCls}-left`]: props.direction === "horizontal" && props.type === "previous", [`${prefixCls}-right`]: props.direction === "horizontal" && props.type === "next", [`${prefixCls}-up`]: props.direction === "vertical" && props.type === "previous", [`${prefixCls}-down`]: props.direction === "vertical" && props.type === "next" }]); return () => { let _slot; return vue.createVNode("div", { "class": cls.value, "onClick": () => props.onClick(props.type) }, [vue.createVNode(iconHover, { "disabled": props.disabled }, _isSlot(_slot = renderIcon()) ? _slot : { default: () => [_slot] })]); }; } }); module.exports = TabsButton;