I'm attempting to display the following template in an alert using vue-sweetalert2
:
<input v-model="name" class="swal2-input">
<select v-model="parent" name="parent" class="form-control">
<option v-for="category in categories" v-bind:value="category.id">
{{category.name}}
</option>
</select>
While I have no issue with a regular template, I am unsure how to implement this in SweetAlert2.
I attempted the following code:
this.$swal({
text: 'edit child',
html:
'<input v-model="name" class="swal2-input">' +
`<select v-model="parent" name="parent" class="form-control">
<option value="">nothing</option>
<option v-for="category in categories" v-bind:value="category.id">
{{category.name}}
</option>
</select>`,
showCancelButton: true,
confirmButtonText: 'edit',
cancelButtonText: 'cancel',
showCloseButton: true,
})
Unfortunately, it displays nothing.