Hidden display of pictures in vue+el-table?

clipboard.png

vue+vue+el-table, , , , , false, , , this

,
clipboard.png

html

<el-table-column width="70">
    <template slot-scope="scope">
        <div class="switch">
            <img class="suspend" v-if="suspendBtn" @click="start(scope.row)" src="../../../../assets/index/start_hover.png">
            <img class="start" v-if="startBtn" @click="suspend" src="../../../../assets/index/suspended.png">
        </div>
    </template>
</el-table-column>

js

  data() {
    return {
      startBtn: false,
      suspendBtn: true,
    };
  },
   methods: {
    start() {
        this.startBtn = true;
        this.suspendBtn = false;
    },
    suspend() {
        this.startBtn = false;
        this.suspendBtn = true;
    }
  }
Mar.24,2021

make sure both methods are written in methods? Why do I look like I'm writing in data


the event bound by each of your buttons is the same. When startBtn changes, of course
the idea is wrong
you can save the playback index, and click on this currently played index


because each suspendBtn,startBtn is the same, and you can put it in the data of each row of the table, just like your time data.

Menu