<template>
  <el-dialog title="旅游标签" :visible.sync="isVisible">
    <el-checkbox-group v-model="list">
    <el-checkbox  v-for="item in allLabelList"
    :key="item.id" :label="item.name"></el-checkbox>
    </el-checkbox-group>
    <div slot="footer" class="dialog-footer">
      <el-button @click="cancel">取 消</el-button>
      <el-button type="primary" @click="okHandler()">确 定</el-button>
    </div>
  </el-dialog>
</template>
<script>
  export default {
    props: ["allLabelList", "checkList"],
    name: 'tourLabelModal',
    data() {
      return {
        isVisible: false,
        list: "",
      }
    },
    created() {

    },
    watch: {
      isVisible(newValue, oldValue){
        if(!newValue){
          this.$emit('tourLabelEvent', false);
        }
      }
    },
    mounted() {
      let that = this;
      this.list = this.checkList;
      this.isVisible = true;
    },
    methods: {
      /**
       * 确定
       * */
      okHandler() {
        this.$emit('tourLabelEvent', this.list);
      },
      /**
       * 弹框-取消
       * */
      cancel() {
        this.$emit('tourLabelEvent', false);
      },
    }
  }
</script>
