Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 48980

How to set predefined values for Select and Datetime

$
0
0

Ionic 5 Vue version

I have two components
Ion Select and Ion DateTime, I need to setup predefined values. However using v-model wont work. Any work around?

Html Structure

<ion-item lines="none" class="input">
                    <ion-label>Priority</ion-label>
                    <ion-select v-model="todoPriority">
                        <ion-select-option value="low">Low</ion-select-option>
                        <ion-select-option value="middle">Middle</ion-select-option>
                        <ion-select-option value="high" selected>High</ion-select-option>
                    </ion-select>
                </ion-item>

                <ion-item lines="none" class="input">
                    <ion-icon :icon="calendarOutline" slot="start"></ion-icon>
                    <ion-label >Due Date </ion-label>
                    <ion-datetime v-model="todoDueDate"  displayFormat="D MMM YYYY H:mm"></ion-datetime>
                </ion-item>

JS

const tomorrow = new Date();
const predefinedDate = tomorrow.setDate(tomorrow.getDate() + 1);
const todoPriority = ref<string>('Low')
const todoDueDate = ref<number>(predefinedDate)

3 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 48980

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>