<template>
  <div>
    <el-dropdown size="small" :hide-on-click="false" @command="addBtn">
      <span class="el-dropdown-link">
        <el-button ref="btn" size="small" type="primary">新 建</el-button>
      </span>
      <el-dropdown-menu slot="dropdown">
        <el-dropdown-item command="框架">经销商合作协议</el-dropdown-item>
        <el-dropdown-item command="经销项目">经销项目协议</el-dropdown-item>
        <el-dropdown-item command="直销项目">直销项目协议</el-dropdown-item>
        <el-dropdown-item command="工具借用">工具借用协议</el-dropdown-item>
        <el-dropdown-item command="居间">居间协议</el-dropdown-item>
      </el-dropdown-menu>
    </el-dropdown>
    <!-- <el-popover
      placement="bottom"
      trigger="hover">
      <div class="box">
        <p>经销商合作协议</p>
        <p>经销商合作协议</p>
        <p>经销商合作协议</p>
        <p>经销商合作协议</p>
      </div>
      <el-button ref="btn" slot="reference" size="small" type="primary">新 建</el-button>
    </el-popover> -->
    <el-drawer
      :visible.sync="drawer"
      :with-header="false"
      direction="rtl"
      size="40%"
      append-to-body
      @close="closeDrawer">
      <div>
        <router-view/>
      </div>
    </el-drawer>
  </div>
</template>

<script>
import {mapGetters} from 'vuex'

export default {
  components:{
  },
  data () {
    return {
      drawer:false,
    }
  },
  computed: {
    ...mapGetters({
      DrawerShow:'DrawerShow'
    }),
  },
  watch: {
    $route (val) {
      // if (val.path == '/submit_mag') {
      //   this.$refs.list.listData()
      // }
    },
    DrawerShow (val) {
      val ? this.drawer = true : this.drawer = false

    }
  },
  methods:{
    closeDrawer () {
      this.$store.dispatch('DrawerShowChange',false)
      console.log("关闭1111")
    },
    addBtn (type) {
      this.$store.dispatch('DrawerShowChange',true)
      this.$router.push({path:'/addContract',query:{type:type}})
    },
    onSubmit () {
    }
  },
  created() {
  },
  mounted () {
  }
}

</script>
<style scoped>
.box p {
  line-height: 40px;
  text-align: center;
}
.box p:hover {
  background: #EBF1FE;
  color: #6191F8;
  cursor: pointer;
}
</style>