<template>
  <div class="snapUpActivityContainer">
    <Select v-model="activityInfoId" filterable>
        <Option v-for="item in list" :value="item.id" :key="item.id">{{ `id ${item.id} - ${item.title}` }}</Option>
    </Select>
    <!-- <Button type="primary" @click="save">保存</Button> -->
  </div>
</template>
<script>
import operationApi from '@api/operation.api';
export default {
  props: {
    value: {
      type: String,
      default: ''
    }
  },
  watch: {
    activityInfoId(val) {
      this.$emit('input', val);  
    }
  },
  components: {
  },
  data() {
    return {
      list: [],
      activityInfoId: ''
    }
  },
  created() {
    this.activityInfoId = this.value;
    this.getActivityList();
    console.log(this.value)
  },
  methods: {
    async getActivityList() {
      const res = await operationApi.getActivityList({
        templateType: 11,
        crowdType: [1],
        userType:[]
      });
      for (let i = 0; i < res.length; i++) {
        res[i].id = res[i].id.toString();
      }
      this.list = res;
    }
  }
}
</script>
<style scoped lang="less">
</style>
