UNPKG

birdpaper-ui

Version:

一个通用的 vue3 UI组件库。A common vue3 UI component library.

43 lines (42 loc) 1.12 kB
"use strict"; const vue = require("vue"); const birdpaperIcon = require("birdpaper-icon"); const _sfc_main = vue.defineComponent({ name: "Link", props: { /** 链接地址 */ href: { type: String, default: "javascript:;" }, /** 链接状态 */ status: { type: String, default: "primary" }, /** 是否禁用 */ disabled: { type: Boolean, default: false }, /** 是否加载状态 */ loading: { type: Boolean, default: false }, /** 跳转链接方式 */ target: { type: String, default: "_self" } }, components: { IconLoader4Line: birdpaperIcon.IconLoader4Line }, emits: { click: (ev) => true }, setup(props, { emit }) { const name = "bp-link"; const clsName = vue.computed(() => { let cls = [name, `${name}-status-${props.status}`]; if (props.disabled || props.loading) cls.push(`${name}-disabled`); return cls; }); const handleClick = (e) => { if (props.disabled) return; emit("click", e); }; return { name, clsName, handleClick }; } }); module.exports = _sfc_main;