我使用vuetify
和vue-property-decorator
来显示警报:
<v-alert dismissible :value="true" color="error" icon="new_releases">
some text.. some text.. <a @click="changeTheAlertMessage">click me</a>.
</v-alert>
如何通过单击a按钮更改内部文本/ html?
@Component({})
export default class SomeView extends Vue {
changeTheAlertMessage() {
//here: How I access to alert instance???
}
}
答案 0 :(得分:0)
在这里您可以找到working example。
使用的方法如下:
changeTheAlertMessage()
的方法,该方法旨在根据您的需要更改文本。我的意思是这样:
new Vue({
el: '#app',
data () {
return {
messageToChange: "Original text"
}
},
methods: {
changeTheAlertMessage: function(event) {
this.messageToChange = "New text"
}
}
})