import { defineComponent } from "vue";
import styles from "./index.module.less";
import IconTitle from "@/assets/icon-title.png";
import { Icon } from "vant";
import IconArrow from '@/assets/icon-arrow.png'

export default defineComponent({
  name: "TheTitle",
  props: {
    title: {
      type: String,
    },
    isMore: {
      type: Boolean,
      default: true,
    },
    onMore: {
      type: Function,
    },
  },
  setup(props) {
    return () => (
      <div class={styles.theTitle}>
        <div class={styles.title}>{props.title}</div>
        <img src={IconTitle} class={styles.img} />
        {props.isMore && (
          <div class={styles.more} onClick={props.onMore}>
            <span>更多</span>
            <Icon name={IconArrow} size={17} />
          </div>
        )}
      </div>
    );
  },
});
