| 123456789101112131415161718192021222324252627282930313233343536 |
- <script lang="ts" setup>
- import { Expand, Fold } from '@element-plus/icons-vue'
- interface Props {
- isActive?: boolean
- }
- const props = withDefaults(defineProps<Props>(), {
- isActive: false
- })
- /** Vue 3.3+ defineEmits 语法 */
- const emit = defineEmits<{
- toggleClick: []
- }>()
- const toggleClick = () => {
- emit('toggleClick')
- }
- </script>
- <template>
- <div @click="toggleClick">
- <el-icon class="icon" :size="20">
- <Fold v-if="props.isActive" />
- <Expand v-else />
- </el-icon>
- </div>
- </template>
- <style lang="scss" scoped>
- .icon {
- vertical-align: middle;
- color: var(--v3-hamburger-text-color);
- }
- </style>
|