From 38b161e4d52362081bfe78fb5b51fbf384db7ce2 Mon Sep 17 00:00:00 2001
From: schangxiang@126.com <schangxiang@126.com>
Date: 周二, 06 5月 2025 07:22:21 +0800
Subject: [PATCH] 222

---
 HIAWms/web/src/components/TdButton/TdButton.tsx |   59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 59 insertions(+), 0 deletions(-)

diff --git a/HIAWms/web/src/components/TdButton/TdButton.tsx b/HIAWms/web/src/components/TdButton/TdButton.tsx
new file mode 100644
index 0000000..5a1090f
--- /dev/null
+++ b/HIAWms/web/src/components/TdButton/TdButton.tsx
@@ -0,0 +1,59 @@
+import { Component, defineComponent, h } from 'vue'
+import styles from './TdButton.module.scss'
+import Text from '../Text/Text'
+import IconButton from '../IconButton/IconButton'
+
+export default defineComponent({
+  name: 'TdButton',
+  props: {
+    text: {
+      type: [String, Object],
+      default: '',
+    },
+    icon: {
+      type: String,
+      default: '',
+    },
+    tip: {
+      type: String,
+      default: '',
+    },
+    disabled: {
+      type: Boolean,
+      default: false,
+    },
+    hover: {
+      type: Boolean,
+      default: false,
+    },
+  },
+  emits: ['click'],
+  setup(props, { attrs, slots, emit }) {
+    return () => {
+      const style = {
+        filter: `grayscale(${props.disabled ? 1 : 0})`,
+        cursor: props.disabled ? 'no-drop' : 'pointer',
+      }
+      return (
+        <div
+          class={{ [styles.text]: true, [styles.hover]: props.hover }}
+          style={style}
+        >
+          <div class={styles.name}>
+            <Text truncated={true} tip={props.tip}>
+              {slots.default?.()}
+            </Text>
+          </div>
+          <IconButton
+            disabled={props.disabled}
+            onClick={() => emit('click')}
+            icon={props.icon}
+            class={styles.iconBtn}
+          >
+            {props.text}
+          </IconButton>
+        </div>
+      )
+    }
+  },
+})

--
Gitblit v1.9.3