To show the date in the showType id after appending it, you can add a watch property to the Vue instance that watches for changes in the date data property. When the date property changes, you can update the text content of the showType element using the textContent property.
Here's an example of how you can implement this:
const app = new Vue({
el: '#app',
data: {
dates: [],
products: [],
date: '',
product_id: '',
},
methods: {
sendData() {
axios.post('(( Surl ))', {
date: this.date,
product_id: this.product_id,
})
.then(response => {
this.dates.push(response.data.date);
this.products.push(response.data.product_id);
alert(response.data);
})
.catch(error => {
console.log(error);
});
}
},
watch: {
date(newDate) {
const showType = document.getElementById('showType');
showType.textContent = newDate;
}
},
components: {
DatePicker: VuePersianDatetimePicker
}
});
In this example, the watch property is added to the Vue instance with a function that takes the new value of the date property as its argument. Inside the function, the showType element is selected using document.getElementById, and its textContent property is set to the new value of the date property.
Note that this solution uses plain JavaScript to manipulate the DOM, rather than using Vue's template syntax. This is because the showType element is not part of the Vue template, but is instead added directly to the Blade template.