当用户使用 element plus 敲击按钮时,我需要在按钮上设置延迟(加载)
<el-button type="primary" :loading="delay_search_button" icon="el-icon-search" size="small" style="width: 14.5vh" @click="searchButton"></el-button>
methods: {
searchButton () {
this.delay_search_button = true;
setTimeout(() => {
this.delay_search_button = false;
console.log(this.delay_search_button)
}, 2000);
},
},
但是这段代码不起作用,我做错了什么?