@epmkit/cra-template-epm-plugin
Version:
The base template for EPM plugins.
26 lines (22 loc) • 572 B
JavaScript
import React, { useCallback } from "react";
import { Button } from "@tinper/next-ui";
import "./index.less";
export default function SamllBtn({ fn, data }) {
const { btnName, isBtnShow } = data;
const { hideBtn, showBtn } = fn;
const handleClick = useCallback(() => {
if (isBtnShow) {
hideBtn();
return;
}
showBtn();
}, [hideBtn, isBtnShow, showBtn]);
return (
<Button
className="plugin-btn"
style={{ width: 400 }}
onClick={handleClick}
type="primary"
>{`隐藏&显示${btnName}按钮`}</Button>
);
}