35 lines
566 B
Vue
35 lines
566 B
Vue
<script lang="ts" setup>
|
|
import { Expand, Fold } from "@element-plus/icons-vue"
|
|
|
|
const props = defineProps({
|
|
isActive: {
|
|
type: Boolean,
|
|
default: false
|
|
}
|
|
})
|
|
|
|
/** Vue 3.3+ defineEmits 语法 */
|
|
const emit = defineEmits<{
|
|
toggleClick: []
|
|
}>()
|
|
|
|
const toggleClick = () => {
|
|
emit("toggleClick")
|
|
}
|
|
</script>
|
|
|
|
<template>
|
|
<div @click="toggleClick">
|
|
<el-icon :size="20" class="icon">
|
|
<Fold v-if="props.isActive" />
|
|
<Expand v-else />
|
|
</el-icon>
|
|
</div>
|
|
</template>
|
|
|
|
<style lang="scss" scoped>
|
|
.icon {
|
|
vertical-align: middle;
|
|
}
|
|
</style>
|