Example:
<script>
import { Toast } from "vant";
export default {
data() {
return {};
},
components: {
[Toast.name]: Toast
},
mounted() {
var aToast = Toast("success");
setTimeout((a)= > {
aToast.clear();
Toast("ok");
}, 100);
setTimeout((a)= > {
/* This is a bug */
console.log("aToast:", aToast);
/* But it also empties the Toast(' OK ') */
aToast.clear();
}, 200); }};</script>
Copy the code
Stop using clear(), which clears out ordinary Toast.