Giter Club home page Giter Club logo

Comments (10)

liu-yuren avatar liu-yuren commented on July 2, 2024 1

@johnleider Look at this question? Urgent and urgent

from vuetify.

TIM56887 avatar TIM56887 commented on July 2, 2024

You need to use different v-model values for each date picker

from vuetify.

liu-yuren avatar liu-yuren commented on July 2, 2024

@TIM56887 but,in vuetify2,no need to use different v-model values for each date picker

from vuetify.

jacekkarczmarczyk avatar jacekkarczmarczyk commented on July 2, 2024

Yes, you need separate models in v2 as well

from vuetify.

liu-yuren avatar liu-yuren commented on July 2, 2024

@jacekkarczmarczyk OK。Next question。 #20015 Can this problem be solved

from vuetify.

liu-yuren avatar liu-yuren commented on July 2, 2024

@jacekkarczmarczyk

you no need separate models in v2 as well。Here is an example。
"dependencies": {
    "core-js": "^3.8.3",
    "dayjs": "^1.11.4",
    "vue": "^2.7.8",
    "vuetify": "^2.6.0"
  }
"devDependencies": {
    "@typescript-eslint/eslint-plugin": "^5.4.0",
    "@typescript-eslint/parser": "^5.4.0",
    "@vue/cli-plugin-babel": "~5.0.0",
    "@vue/cli-plugin-eslint": "~5.0.0",
    "@vue/cli-plugin-router": "~5.0.0",
    "@vue/cli-plugin-typescript": "~5.0.0",
    "@vue/cli-service": "~5.0.0",
    "@vue/eslint-config-typescript": "^9.1.0",
    "babel-loader": "^9.1.3",
    "eslint": "^7.32.0",
    "eslint-config-prettier": "^8.3.0",
    "eslint-plugin-prettier": "^4.0.0",
    "eslint-plugin-vue": "^8.0.3",
    "prettier": "^2.4.1",
    "sass": "^1.32.7",
    "sass-loader": "^12.0.0",
    "typescript": "~4.5.5",
    "vue-cli-plugin-vuetify": "~2.5.1",
    "vuetify-loader": "^1.7.0"
  }
<template>
  <v-container fluid>
    {{ state.dates }}
    <v-row class="pt-2">
      <v-col v-for="month in 12" :key="month">
        <v-date-picker
          v-model="state.dates"
          no-title
          multiple
          elevation="2"
          :day-format="dayFormat"
          :min="getFirstDate(month)"
          :max="getLastDate(month)"
          :picker-date="getFirstDate(month)"
          next-icon=""
          prev-icon=""
          color="primary"
        ></v-date-picker>
      </v-col>
    </v-row>
  </v-container>
</template>

<script setup lang="ts">
import { reactive, Ref, ref } from 'vue';

const state = reactive({
  dates: ['2021-01-01', '2021-02-11', '2022-01-10', '2023-02-11', '2023-10-09'],
});
const year: Ref<number> = ref(2022);

const dayFormat = (date: string): number => {
  return new Date(date).getDate();
};

// yyyy-mm-dd
const formatDate = (dt: Date): string => {
  var y = dt.getFullYear();
  var m = ('00' + (dt.getMonth() + 1)).slice(-2);
  var d = ('00' + dt.getDate()).slice(-2);
  return y + '-' + m + '-' + d;
};

const getFirstDate = (monthIndex: number): string => {
  console.log(formatDate(new Date(year.value, monthIndex - 1, 1)), '====');

  return formatDate(new Date(year.value, monthIndex - 1, 1));
};

const getLastDate = (monthIndex: number): string => {
  return formatDate(new Date(year.value, monthIndex, 0));
};
</script>

from vuetify.

jacekkarczmarczyk avatar jacekkarczmarczyk commented on July 2, 2024

Ah, I see, I misunderstood the issue

from vuetify.

liu-yuren avatar liu-yuren commented on July 2, 2024

Okay, in the near future, do the team have plans to solve these two problems。#20015#20016 。Because this component is useful in the project。@jacekkarczmarczyk @johnleider

from vuetify.

johnleider avatar johnleider commented on July 2, 2024

I don't entirely understand what you're trying to do. From your playground, it's behavior exactly as I would expect given the provided code.

from vuetify.

liu-yuren avatar liu-yuren commented on July 2, 2024
<v-row>
      <v-col cols="6" v-for="month in 12" :key="month">
        <v-date-picker
          v-model="dates"
          hide-header
          multiple
          elevation="2"
          :min="getFirstDate(month)"
          :max="getLastDate(month)"
          next-icon=""
          prev-icon=""
          color="primary"
          :year="year"
          :month="month - 1"
        >
        </v-date-picker>
      </v-col>
    </v-row>

in vuetify2, Choosing a certain month date does not affect other v-date picker components. Why is the same code two behaviors in vuetify2 and vuetify3

from vuetify.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.