Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to change width and height of vuejs-datepicker

I looked into this vuejs-datepicker to add datepicker to my project.

<div class="startDate">
    <datepicker
     v-model="startDate"
     format="YYYY-MM-DD"
     name="startDate"
     ></datepicker>
</div>

import datepicker from "vue-date-picker";

<style scoped>
  .startDate {
   width: 150px;
   }
<style>

But still width of startDate shows 238px which is default width of datepicker.

like image 286
Ajay Avatar asked Sep 29 '19 11:09

Ajay


2 Answers

try this

<div>
    <datepicker class="startDate"
        v-model="startDate"
        :readonly="true"
        format="YYYY-MM-DD"
        name="startDate"
     ></datepicker>
</div>

 .startDate {
    width: 150px;
     }
like image 116
sid heart Avatar answered Nov 01 '22 13:11

sid heart


First of all remove scoped from style portion. And obtain classname by inspecting datepicker element.

Here, in my case classname for startDate is .datetime-picker input[data-v-a46a390c]

Now, apply to css like this:

.datetime-picker input[data-v-a46a390c] {
  width: 150px;
  height: 38px;
}
like image 35
Ajay Avatar answered Nov 01 '22 13:11

Ajay