Is there a way to convert the span
into an actual element? I am encountering an error with appendChild
as it sees the variable as a string rather than an object. Any suggestions on how to resolve this?
export default{
data(){
....
}
methods:{
update_period: function(event){
var start = moment(event.start).format('M/D/Y'),
end = moment(event.end).format('M/D/Y');
var span = `<span @click="remove">{{ start }} - {{ end }}</span>`
this.$refs.spans.appendChild(span);
},
remove: function(event){
event.target.remove()
}
}
}
<div ref="spans">
</div>