NewbieButton

按钮组件 在原生基础上增加了 loading 状态,以及图标的支持 loading 状态配合 useFetch 可以自动化处理

Version: 1.0.0

Props

Prop nameDescriptionTypeValuesDefault
type按钮类型stringprimary, ghost, dashed, link, text, default"default"
size按钮大小stringlarge, middle, small"middle"
disabled失效状态boolean-false
danger设置危险按钮boolean-false
label按钮标签string-""
icon按钮图标,需要使用object-null
iconPosition按钮图标位置stringleft, right"left"
fetcher请求状态控制器
@params .loading 是否加载中
object-{
loading: false
}
buttonProps原生 Buttonopen in new window 配置object-{}

Events

Event namePropertiesDescription
clickevent Event - 点击事件

示例


<NewbieButton>默认</NewbieButton>
<NewbieButton type="primary">点我</NewbieButton>
<NewbieButton type="primary" size="small">点我</NewbieButton>
<NewbieButton type="primary" size="larger">点我</NewbieButton>
<NewbieButton type="primary" danger>危险</NewbieButton>
<NewbieButton type="primary" danger disabled>危险</NewbieButton>

<NewbieButton type="primary" :icon="h(EditOutlined)" label="编辑"></NewbieButton>
<NewbieButton type="primary" :icon="h(EditOutlined)" icon-position="right" label="编辑"></NewbieButton>

<template>
	<NewbieButton type="primary" :fetcher="fetcher" :icon="h(SaveOutlined)" label="保存" @click="onSave"></NewbieButton>
</template>

<script setup>
import { NewbieButton } from "jobsys-newbie"
import { h } from "vue"
import { SaveOutlined } from "@ant-design/icons-vue"

const fetcher = ref({ loading: false })

const onSave = () => {
	fetcher.value.loading = true

	setTimeout(() => {
		fetcher.value.loading = false
	}, 2000)
}
</script>
Last Updated:
Contributors: sinceow