<template>
  <div>
    <ht-sidebar-dialog
      title="分类管理"
      :visible.sync="dialogVisible"
      width="28%"
      :before-close="handleClose"
    >
      <ht-aside-tree
        v-if="catId"
        :cat-id="catId"
        :has-navbar-collapse="false"
        :default-expanded-keys="defaultExpandedKeys"
        :has-footer="false"
        width="80%"
      />
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="dialogVisible = false"
          >确 定</el-button
        >
      </span>
    </ht-sidebar-dialog>
  </div>
</template>

<script>
import portalApi from '@/api/portal.js'
const htAsideTree = () => import('@/components/common/HtAsideTree.vue')
export default {
  components: {
    htAsideTree,
  },
  name: 'ClassDialog',
  data() {
    return {
      dialogVisible: false,
      catId: "",
      options: []
    }
  },
  computed: {
    defaultExpandedKeys: function() {
      let defaultExpandedKeys = [];
      defaultExpandedKeys.push(this.catId);
      return defaultExpandedKeys;
    }
  },
  methods: {
    open(row) {
      this.dialogVisible = true
      this.catId=row.id
    },
    handleClose(done) {
      this.$confirm('确认关闭？')
        .then((_) => {
          done()
        })
        .catch((_) => {})
    },
  },
}
</script>

<style lang="scss" scoped>
/deep/.el-dialog{
    height: 70%;
    .el-dialog__body{
        height: 60%;
    }
}
</style>