0

I want to set a default value for input of data picker with vue,but the data doesn't show! in the inspect element show this code:

enter image description here

script:

   new Vue({
   el:'#app2',
    data: {
         datePicker: '2021/01/05'
    },
    components:{
          datePicker
    }

           

html:

 <div id="app2">
     <date-picker :column="1" v-model="date" mode="single" />
 </div>

2
  • you used v-model="date" but in data dataPicker is present not date Commented Jan 18, 2021 at 11:00
  • which module are you using? Commented Jan 18, 2021 at 11:05

1 Answer 1

1

Add value-type it will set the format of binding value and format will help to assign the display format.

<date-picker :column="1" v-model="datePicker" value-type="YYYY/MM/DD"
    format="YYYY/MM/DD" mode="single" />   

and

new Vue({
            el:'#app2',
            data(){
                return {
                 datePicker: '2021/01/05'
               }
             },
            components:{
                datePicker
            }
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.