This commit is contained in:
Putoo
2026-05-19 18:34:24 +08:00
parent 24c784e6a4
commit 2c85872abd
10 changed files with 341 additions and 61 deletions

View File

@@ -1,12 +1,9 @@
<template>
<button class="but" @click="handleClick">{{ text }}</button>
<button class="but" @click="handleClick">
<slot></slot>
</button>
</template>
<script lang="ts" setup>
// 1. 定义接收父组件传来的参数 props
const props = defineProps({
// 字段名、类型、默认值
text: String,
})
const emit = defineEmits(['click'])
// 定义 click 事件
@@ -19,11 +16,16 @@ const handleClick = (): any => {
<style>
.but {
text-decoration: underline;
/* text-decoration: underline; */
color: #1e5494;
font-size: 18px;
cursor: pointer;
background: none;
border: none;
}
.but:hover{
color: #FFFFFF;
background: #1e5494;
}
</style>