mengxiong10 / vue-datepicker-next

A datepicker / datetimepicker component for Vue3
https://mengxiong10.github.io/vue-datepicker-next/
MIT License
147 stars 34 forks source link

[Question] How do I set the name of the input field? #58

Open Asuza opened 4 months ago

Asuza commented 4 months ago

Vue-datepicker-next version: 1.0.3 Vue version: 3.4.15 Browser: Firefox

I'm trying to understand how to set the name value, but I can't get it to work. I'm using the DatePicker in another component, and have it set up like so:

    <DatePicker
      v-bind="$attrs"
      ref="input"
      :format="format"
      :type="type"
      name="this_is_a_test"
      :value="value"
      @input="onInput"
      @change="handleChange"
      @blur="handleBlur"
    >

But when I inspect the DOM, it ends up like:

<input name="date" type="text" autocomplete="off" class="required form-control" readonly="">

I also tried some other ways to set it after skimming the source code but nothing changed the name. Please let me know how to do that. I couldn't find any examples in the documentation. Thanks!