import React from 'react';
import { View, Image } from '@tarojs/components';
const addIcon = 'https://wanmi-b2b-x-site.oss-cn-shanghai.aliyuncs.com/pandora-ui/assets/templates/images/stepper/icon-stepper.png';
import {CompDefault, MetaProps} from "../data-channel";
import connect from '../connect';

export interface Props extends MetaProps {
  // 禁用状态
  disabled?: boolean;
  // 添加数量回调
  getNum: (count?: number, flag?: boolean) => void;
}

export interface State {}

const defaultValue: CompDefault<Props, State> = {
  props: {},
  state: {},
  meta: {},
}

const StepperAdd: React.FC<Props> = (props) => {
  return (
    <View
      className='wm-add-cart'
      onClick={props.disabled ? () => {} : () => props.getNum()}>
      <View className='box'>
        <Image src={addIcon} className='img' />
      </View>
    </View>
  );
};

export default connect(StepperAdd, defaultValue);
