There is such a code
const app = new Vue({ router, el: '#app', template: '<p>111111</p>', data: { items: [], }, created: function () { this.fetchData(); }, watch: { // call again the method if the route changes '$route': 'fetchData' }, methods: { fetchData: function () { var requestUrl = this.$router.options.base + this.$router.history.current.fullPath; var self = this; this.$http.get( requestUrl ).then( response => this.$options.template = '<strong>22222</strong>' ); //not working :( // this.$options.template = '<strong>22222</strong>' // working } } }); Those. it turns out when changing the route, an ajax request is sent, and I want to dynamically change the template, but nothing happens, there are no errors, it just displays the initial version
<p>111111</p> Actually why and how can this be done?