UNPKG

taro-ui-vue3

Version:

Taro UI Rewritten in Vue 3.0

37 lines (36 loc) 863 B
import {h, defineComponent, computed, mergeProps} from "vue"; import {View} from "@tarojs/components"; const AtFab = defineComponent({ name: "AtFab", props: { size: { type: String, default: "normal", validator: (prop) => ["normal", "small"].includes(prop) }, onClick: { type: Function, default: () => () => { } } }, setup(props, {attrs, slots}) { const rootClass = computed(() => ({ "at-fab": true, [`at-fab--${props.size}`]: props.size })); function onClick(e) { if (typeof props.onClick === "function") { props.onClick(e); } } return () => h(View, mergeProps(attrs, { class: rootClass.value, onTap: onClick }), {default: () => slots.default && slots.default()}); } }); var fab_default = AtFab; export { fab_default as default };