Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.9k views
in Technique[技术] by (71.8m points)

el-table tableData重新赋值的情况下,如何保存之前多选的数据

功能区

<div class="function-area">

 <div

 @click="selectModule(item)"

 v-for="(item,index) in modules"

 :key="index"

 class="moduleName"

 :class="moduleId==item.id?'act':''"

 >

 <span>{{item.name}}</span>

 </div>

 </div>

选择功能区

 //选择功能区

 selectModule(val)?{

   this.$axios.post(`url`, data).then((res) => {

   if (res.success)?{
   //每次切换功能区的时候 tableData都重新赋值了

   this.tableData = res.result;

   } else {

   this.$message.error(res.message);

   }

 });

 },

表格的多选方法

 handleSelectionChange(val)?{

   this.selectionId = val.map((item) => {

   return item.id;

   });

 },

现在就是想切换功能区的时候 缓存下 this.selected 并且 能同步到用户 全选 选中 取消选中这些情况下的精准数据

有什么好的实现思路吗


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

:reserve-selection="true"


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...