import { Row, Col, Image, Icon } from 'vant'
import { defineComponent } from 'vue'
import styles from './index.module.less'

export const getAssetsHomeFile = (fileName: string) => {
  const path = `../../images/${fileName}`
  const modules = import.meta.globEager('../../images/*')
  return modules[path].default
}

export default defineComponent({
  name: 'hot-goods',
  props: {
    hotProductList: {
      type: Array,
      default: []
    },
    onOpenWebView: {
      type: Function,
      default: (n: any) => {}
    }
  },
  render() {
    return (
      <div class={styles.hotGoods}>
        {/* <img src="" alt="" /> */}
        <div class={styles.hotGoodsSection}>
          {this.hotProductList.map((item: any) => (
            <div
              class={styles.hotGoodsItem}
              onClick={() => {
                this.onOpenWebView('/goodsDetail?id=' + item.id)
              }}
            >
              <Image
                class={styles.hotGoodsItemImg}
                src={item.pic}
                fit="cover"
              />
            </div>
          ))}
        </div>
      </div>
    )
  }
})
