I'd like to know how to update a Bootstrap-Vue ( Bootstrap-Vue ) alert's content after it's shown.
This is needed in such a scenario: display an alert with a link, the user clicks the link to initiate a remote operation, the alert displays a loading indicator, the the operation completes, finally the alert displays a success message.
It's just like updating any other reactive property. The example below shows three states... default, loading and updated.
<template>
<div id="app">
<b-alert show>{{ alertText }}</b-alert>
<b-btn @click="updateText">Update Text</b-btn>
</div>
</template>
<script>
export default {
name: "App",
data() {
return {
alertText: 'Default text',
}
},
methods: {
updateText() {
this.alertText = 'loading'
setTimeout(() => {
this.alertText = Math.random()
}, 2000)
},
}
}
</script>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.