Answer the question
In order to leave comments, you need to log in
How to correctly initialize a component?
Introductory:
no build systems are used
We have:
Vue is connected to the page
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<div id="app">
<date-pick
v-model="date"
:pick-time="true"
:selectable-year-range="{ from: 2000, to: 2020 }"
:format="'DD.MM.YYYY HH:mm'">
</date-pick>
</div>
new Vue({
el: '#app,
data: {
date: ''
},
components: {
'date-pick': VueDatePick
}
})
<date-pick v-model="date"></date-pick>
data: function(){
return {
date: ''
}
}
Answer the question
In order to leave comments, you need to log in
HTML:
<div id="app">
<date-pick
v-model="date1"
:pick-time="true"
:selectable-year-range="{ from: 2000, to: 2020 }"
:format="'DD.MM.YYYY HH:mm'">
</date-pick>
<date-pick
v-model="date2"
:pick-time="true"
:selectable-year-range="{ from: 2000, to: 2020 }"
:format="'DD.MM.YYYY HH:mm'">
</date-pick>
</div>
new Vue({
el: '#app',
data: {
date1: '',
date2: '',
},
components: {
'date-pick': VueDatePick
}
})
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question