<script>
import { userList } from 'api'
export default {
data() {
sourceL null,
dataList: []
},
methods: {
cancelQuest() {
if (typeof this.source === 'function') {
this.source('终止请求');
}
},
getData() {
this.cancelQuest()
userList({name: '', pageNum: 1, pageSize: 10}, this).then((res) => {
this.dataList = res.data
})
}
}
}
</script>
export function userList(Obj,that) {
return axios({
method:'POST',
url: "xxxxxx",
data:Obj,
cancelToken: new AXIOS.CancelToken(function executor(c) {
that ? that.source = c : ''
})
})
}