0
votes

This is the component I want to use [https://krystalcampioni.github.io/vue-hotel-datepicker/] [https://github.com/krystalcampioni/vue-hotel-datepicker#i18n] for date picker on my index.html but it is me giving an error Failed to mount component: template or render function not defined. Below is the code I have written on my index.html`

//index.html
<html>
    <script src="path/to/vue.js"></script> 
    <script src="vue-hotel-datepicker/dist/vue-hotel-datepicker.min.js"></script> 
    <body>
        <div id="app">
            <HotelDatePicker/></<HotelDatePicker>
        </div>
        <script>
            new Vue({
                el: '#app',
                components: { HotelDatePicker }
            })
        </script> 
    </body>
</html>

`

1
you must use require for thisMoher

1 Answers

0
votes

If youre using a build tool, You must import the component before registering it with the vue instance

import HotelDatePicker from 'vue-hotel-datepicker'

new Vue({
       el: '#app',
       components: { HotelDatePicker }
 })

Otherwise use require

new Vue({
     el: '#app',
     components: {
          'vue-hotel-datepicker': require('vue-hotel-datepicker')
     }
})