<template>
  <el-dialog
    v-loading="loading"
    title="选择图标"
    :center="true"
    align="left"
    top="7vh"
    width="840px"
    :close-on-click-modal="false"
    :visible.sync="showModelThis"
    element-loading-text="拼命加载中"
    element-loading-spinner="el-icon-loading"
    element-loading-background="rgba(0, 0, 0, 0.8)"
    append-to-body
    @close="showModelThis = false"
  >
    <el-card>
      <el-row :gutter="10">
        <el-col :span="24">
          <icon-list v-model="icon" />
        </el-col>
        <el-col :span="24" style="text-align: right;">
          <!-- <el-button type="primary" @click="submitForm">
              保 存
          </el-button> -->
          <el-button @click="showModelThis = false">取 消</el-button>
        </el-col>
      </el-row>
    </el-card>
  </el-dialog>
</template>

<script>
export default {
  props: ['showModel'],
  data() {
    return {
      loading: false,
      icon: '',
      showModelThis: this.showModel
    }
  },
  watch: {
    icon(val) {
      if (val) {
        this.showModelThis = false
        this.$emit('setVal', val)
      }
    },
    showModel: function(val) {
      this.showModelThis = val
    },
    showModelThis(val) {
      if (!val) {
        this.$emit('cancel')
      }
    }
  },
  methods: {
    closeModel() {
      console.log('closeModel!!')
    }
  }
}
</script>

<style></style>
