ly525 / material-vue-daterange-picker

a date-range-picker follows the Material Design spec powered by vue.js (alpha)
https://ly525.github.io/material-vue-daterange-picker/
MIT License
73 stars 20 forks source link

v-model is not working #60

Open RakibSiddiquee opened 5 years ago

RakibSiddiquee commented 5 years ago

How to get value of the range picker in change event? I tried using v-model, but its not working. Please help.

ly525 commented 5 years ago

@RakibSiddiquee Sorry, I got a todo list for v-model:

https://github.com/ly525/material-vue-daterange-picker/blob/ee4d5c8d1a11472174afe6d4e4612421c5e8b4d6/src/components/Picker.vue#L343

You can use @change and value to mock v-model temporarily, I will implement the function this weekday.

RakibSiddiquee commented 5 years ago

How to pass the value in @change? any example?

ly525 commented 5 years ago

@RakibSiddiquee sorry, I almost forgot that we do not support prop: value, you need to set startDate and endDate to mock value temporarily I will support value(Array) prop soon.

ly525 commented 5 years ago

@RakibSiddiquee I have updated the docs

If you has any question, please let me know!

<template>
  <div>
    <v-md-date-range-picker
      :opens="opens"
      start-date="2019-01-01"
      end-date="2019-01-02"
      @change="handleChange"
    ></v-md-date-range-picker>
    <div style="margin: 10px">
      values: {{values}}
    </div>
  </div>
</template>
<script>
export default {
  data: () => ({
    values: [],
  }),
  methods: {
    handleChange (values) {
      console.log(values)
      this.values = values
    }
  }
}
</script>
RakibSiddiquee commented 5 years ago

That's great! You saved my day dude.

ly525 commented 5 years ago

@RakibSiddiquee I will mark this issue as TODO, If I complete it, I will @you. If you has any question, please let me know.