I have this alert component and in the body field I try to use const "item". The const "item" is in the Vue method, is it possible to get the const "item" result in that alert body field? I tried {item} {{item}} without success. Thanks
<alert v-if="warning" :show-alert="showAlert" :options="{ body: "message" {item} {{item}} }" color="#ffc107" style="max-width: 670px; width: 100%;" @input="showAlert = false" /> ... export default { data () { return { warning: '', showAlert: true, item: null } }, ... methods: { const item = result.hits[0].refs.id[0] ...
My answer is no, why should we bind constants in HTML templates? Because you already have item property in your data object. You can update the item value in this property instead of assigning the value in
const
.For example:
this.item = 'item value'
instead ofconst item = 'item value'