<!--
 * @Author: peerless_hero peerless_hero@outlook.com
 * @Date: 2023-07-08 01:44:59
 * @LastEditors: peerless_hero peerless_hero@outlook.com
 * @LastEditTime: 2023-07-10 04:27:19
 * @FilePath: \uni\packages\card-actions\index.vue
 * @Description:
 *
-->
<template>
  <view class="th-card-actions" color="#3b82f6" w-full flex flex-row items-center justify-center overflow-hidden>
    <view h-1px bg="#dcdcdc" />
    <view
      v-for="(action, index) in actions"
      :key="index"
      active="bg-#f2f7ff"
      fs-26
      h-106rpx
      leh-106
      cursor-pointer
      flex-grow
      text-center
      @click="emit('select', index)"
    >
      {{ action.text }}
      <Image v-if="action.icon" :src="action.icon" mode="scaleToFill" />
    </view>
  </view>
</template>

<script lang="ts" setup name="CardActions">
defineProps<{
  actions?: Array<{
    /** 按钮文字 */
    text?: string
    /** 图标 */
    icon?: string
  }>
}>()

const emit = defineEmits<{
  (event: 'select',
    /** 单击的索引值 */
    index: number): void
}>()

emit('select', 0)
</script>
