<template>
    <div>
        <el-table ref="multipleTable" :data="dataList" tooltip-effect="dark" style="width: 100%"
        @selection-change="handleSelectionChange">
            <el-table-column type="selection" width="55">
            </el-table-column>
            <el-table-column prop="NavName" label="名称">
            </el-table-column>
            <el-table-column prop="NavLink" label="导航链接">
            </el-table-column>
        </el-table>
    </div>
</template>
<script>
  export default {
    data() {
      return {
        dataList: [],
        selectRow:[],
      };
    },
    created() {},
    methods: {
      //获取所有菜单
      getList() {
        this.apipost("/api/Tenant/GetMallNavList", {}, res => {
          if (res.data.resultCode == 1) {
            this.dataList = res.data.data
          } else {
            this.Info(res.data.message);
          }
        })
      },
      handleSelectionChange(val){
        this.selectRow=JSON.parse(JSON.stringify(val));
      },
      //父组件调用方法
      getChoicedLunbo(){
        return this.selectRow;
      },
      //清空多选方法
      toggleSelection(rows) {
        if (rows) {
          rows.forEach(row => {
            this.$refs.multipleTable.toggleRowSelection(row);
          });
        } else {
          this.$refs.multipleTable.clearSelection();
        }
      },  
    },
    mounted() {
      this.getList();
    }
  };

</script>
