Comments (10)
@johnleider Look at this question? Urgent and urgent
from vuetify.
You need to use different v-model values for each date picker
from vuetify.
@TIM56887 but,in vuetify2,no need to use different v-model values for each date picker
from vuetify.
Yes, you need separate models in v2 as well
from vuetify.
@jacekkarczmarczyk OK。Next question。 #20015 Can this problem be solved
from vuetify.
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.
Ah, I see, I misunderstood the issue
from vuetify.
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.
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.
<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)
- [Bug Report][3.6.9] VDatePicker crash on danish with "date value is not finite in DateTimeFormat.format()"
- [Bug Report][3.6.9] TreeView unable to select multiple items since 3.6.9
- [Bug Report][3.6.9] v-stepper-vertical: Data Loss on Step Change HOT 1
- [Bug Report][3.6.9] Maximum recursive updates exceeded with v-for on snackbars HOT 2
- [Bug Report][3.6.9] VTextField displays inputs that should be hidden out of VField default slot
- [Feature Request] Better Keyboard/Accessibility support for new Date input component
- [Bug Report][3.6.10] VTable's global class setting affects VDataTable
- [Bug Report][3.6.10] VTextArea does not work correctly with both auto-grow and v-model.trim
- [Documentation] Deprecated useDisplay properties (xsOnly, smOnly, mdOnly, lgOnly, xlOnly)
- [Feature Request] Documentation for all the new versions
- [Bug Report][3.6.10] VDataTable group is not sorted when key is not in header HOT 4
- [Bug Report][3.6.10] VDataTable: GroupBy sort is not possible when sorting is disabled
- [Feature Request] Expose hasNext and hasPrev in v-slide-group
- [Bug Report][3.6.10] VSpeedDial content-class prop doesn't work
- [Documentation] code example of v-data-table prop filterable is not showcasing filterable
- [Feature Request] Support for Material Symbols
- [Bug Report][3.6.10] The date picker of the input is being stuck at the top/bottom if you scroll element out of the viewport
- [Feature Request] V3 V-Data-Table shift key multi-select
- [Bug Report][3.6.10] VNumberInput - increment/decrement slots only work with default control variant
- [Feature Request] Bring back VItemGroup valueComparator
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vuetify.