Looping a new <q-item> with <q-popoup-edit> nested doesn't work in quasar framework - vue.js

I have been searching for solution for my problem, but still not resolved :')..
Anyway, Thanks so much for the help, Masters :)
So,
I have a button for add new task with this code inside the q-item-section , but when I clicked it, it is not adding new item as a expected..
<q-btn
#click="addMore"
class="text-weight-bolder"
label="Add"
size="14px"
color="white"
flat
icon-right="mdi-plus-circle-outline"
/>
By clicking above button, it will shows a new item (by using following code below), which is needed to be filled by users
<q-item v-for="task in todoOthers2" :key="task">
<q-item-section avatar>
<div class="cursor-pointer size-16px">
{{ task.time }}
<q-popup-edit v-model="time" class="bg-grey-2 text-white" :cover="false" :offset="[0, 10]" v-slot="scope">
<q-input filled v-model="todoOthers2.time" mask="time" :rules="['time']">
<template v-slot:append>
<q-icon name="access_time" class="cursor-pointer text-primary">
<q-popup-proxy transition-show="scale" transition-hide="scale">
<q-time v-model="time">
<div class="row items-center justify-end">
<q-btn v-close-popup label="Close" color="primary" flat />
</div>
</q-time>
</q-popup-proxy>
</q-icon>
</template>
</q-input>
</q-popup-edit>
</div>
</q-item-section>
<q-item-section no-wrap >
<div class="cursor-pointer text-weight-bolder" style="width: 100px">
{{task.activity}}
<q-popup-edit v-model="todoOthers2.activity" class="bg-grey-2 text-white" :cover="false" :offset="[0, 10]" v-slot="scope">
<q-input v-model="scope.value" dense autofocus counter #keyup.enter="scope.set">
<template v-slot:append>
<q-icon name="edit" />
</template>
</q-input>
</q-popup-edit>
</div>
</q-item-section>
<q-item-section top side>
<div class="text-grey-8 q-gutter-xs">
<q-btn size="12px" color="secondary" flat dense round icon="mdi-check-circle" />
<q-btn size="12px" color="negative" flat dense round icon="mdi-delete" />
</div>
</q-item-section>
</q-item>
Here is the setup()
setup() {
const todoOthers2 = ref({
activity:"Add Your Task Here",
time:"08:00"
function addMore(){
todoOthers2.value.push({
activity: "Add Your Task Here",
time:"08:00"
})
return {
todoOthers2,
addMore,
}
}

Related

How to position a row at the bottom of a q-scroll-area in Quasar

I have a sidebar menu where I am trying to put my social media section at the bottom of the sidebar but I am struggling to get flex to work and do so. I tried item-stretch on the second row but the issue is the row does not expand the entire scroll area. The closest example which is not quasar per say can be found here https://preview.colorlib.com/#elen
Sidebar Component:
<template>
<div class="navigation-links q-pa-lg">
<q-list padding>
<q-item clickable v-ripple class="q-pa-md q-ma-md menu-item">
<q-item-section avatar>
<q-icon name="fa-solid fa-house" style="font-size:1.25rem"/>
</q-item-section>
<q-item-section>
HOME
</q-item-section>
</q-item>
<q-item active clickable v-ripple class="q-pa-md q-ma-md menu-item active-menu-item">
<q-item-section avatar>
<q-icon name="fa-solid fa-shirt" style="font-size:1.25rem"/>
</q-item-section>
<q-item-section>
SERVICES
</q-item-section>
</q-item>
<q-item clickable v-ripple class="q-pa-md q-ma-md menu-item">
<q-item-section avatar>
<q-icon name="fa-solid fa-envelope" style="font-size:1.25rem"/>
</q-item-section>
<q-item-section>
CONTACT US
</q-item-section>
</q-item>
</q-list>
</div>
<div class="socialmedia-links q-pa-lg text-center column no-wrap flex-center self" style="">
<div class="row">
<q-btn flat size="sm" color="primary" round icon="fa-brands fa-google" aria-label="google" class="float-right q-ma-sm no-shadow"/>
<q-btn flat size="sm" color="primary" round icon="fa-brands fa-facebook-f" aria-label="facebook" class="float-right q-ma-sm no-shadow"/>
<q-btn flat size="sm" color="primary" round icon="fa-brands fa-instagram" aria-label="instagram" class="float-right q-ma-sm no-shadow"/>
</div>
<h2 class="text-h5 text-weight-bolder q-mb-xs">CONNECT WITH US</h2>
<h6 class="text-subtitle1 text-accent text-weight-normal q-my-none">If you like what you have seen so far we can guarentee you will appreciate our print quality.</h6>
</div>
<script setup>
import { ref } from 'vue'
const searchText = ref('')
</script>
<style lang="scss" scoped>
.block-wrapper{
max-width: 1024px;
margin-left: auto;
margin-right: auto;
}
.active-menu-item{
background-color: $background-accent;
}
.menu-item{
letter-spacing: .15rem;
font-weight:500;
border-radius: 7px;
}
</style>
Layout Component
<q-drawer
v-model="navigationDrawer"
bordered
side="left"
behavior="mobile"
:width="$q.screen.width >= 400 ? 400 : $q.screen.width"
>
<q-scroll-area class="fit q-pa-lg">
<div class="row justify-end">
<q-btn flat round icon="fa-solid fa-xmark" aria-label="Menu" #click="toggleNavigationDrawer"/>
</div>
<div class="row" style="min-height: 100%;">
<div class="col-12">
<HomeSidebar/>
</div>
</div>
</q-scroll-area>
</q-drawer>
Turn q-scroll-area's content container into a flex column. You can apply CSS classes directly to the container with :content-style prop
<q-scroll-area
class="fit q-pa-lg"
:content-style="{ display: 'flex', 'flex-direction': 'column' }"
>
Also make the div surrounding the sidebar a flex column with justify-content: space-between. The row surrounding it should also have flex-grow: 1
<div class="row" style="min-height: 100%; flex-grow: 1">
<div class="col-12 flex column justify-between">
<HomeSidebar/>
</div>
Here's a sandbox that shows the result

How to pass props to third child in nuxt

ModalsComponent is being global to all my cards
This how I am calling CardComponent:
<CardComponent
v-for="card of cards"
:key="card.urlsId"
:cardImages="card.images"
:cardTitle="card.title"
:cardDescription="card.description"
:mediaRef="card.urlsId"
:dbRef="card.dbId"
:deleteBtn="true"
:imagesWithSlider="true"
:deleteModalOpen="deleteModalOpen"
#onOpenDeleteModal="
;(deleteModalOpen = true), (newCardModalOpen = false)
"
#onCloseDeleteModal="deleteModalOpen = false"
/>
And this is how my CardComponent looks like:
<template>
<div class="cards">
<ModalsComponent
v-if="deleteModalOpen"
:deleteModal="true"
#closeModal="$emit('onCloseDeleteModal')"
#onDeleteCard="log"
/>
<v-card class="card-container">
<div class="delete-btn">
<v-btn
v-if="deleteBtn"
class="mx-2"
fab
dark
small
#click="
$emit('onOpenDeleteModal'), (deletingCardRefs = { dbRef, mediaRef })
"
>
<v-icon dark> mdi-delete </v-icon>
</v-btn>
</div>
<ImageSlider
v-if="imagesWithSlider"
:imagesArray="cardImages"
:arrowBtns="false"
/>
<v-img v-else></v-img>
<div class="text-container">
<h3 class="card-title">{{ cardTitle }}</h3>
<p class="card-description">{{ cardDescription }}</p>
</div>
</v-card>
</div>
</template>
in CardComponent it is being looped after v-card element and my ModalsComponent being global to all my cards how to target it each of my cards separately?

How do I get a div to overflow and not extend the page using flex box?

Here is my code:
<template>
<div class="main-column d-flex flex-column h-100">
<div class="pl-3 pr-3">
<filter-panel ref="filterComp" :controls="filterControls" :urlParams="$route.query" #filterResults="onSearchClicked" />
</div>
<div class="flex-grow-1 d-flex flex-column px-1 py-2 bg-container">
<div class="position-relative h-100">
<div class="absoluteFill">
<div class="collapse-panel nested-background mb-2 w-100">
<div class="collapse-bar full-length">
<b-button class="buttonRow w-100 py-0 d-flex justify-content-between" size="sm" variant="link" #click="hideGraphs = !hideGraphs" v-b-toggle.count-collapse>
<span class="title">Chart</span>
<icon :class="{'down': hideGraphs}" class="icon rotate mt-1" icon="chevron-up" size="lg" />
</b-button>
</div>
<b-collapse id="count-collapse" visible>
<transition name="fade" mode="out-in">
<div>
<DxChart :data-source="graphData"
palette="Material"
class="p-3">
<DxCommonSeriesSettings type="bar" argument-field="date">
<DxLabel>
<DxFormat :precision="0" type="fixedPoint" />
</DxLabel>
</DxCommonSeriesSettings>
<DxSize :height="350" />
<DxSeries name="Mapping Client"
value-field="mappingClient"
color="#a4de02" />
<DxSeries name="Mapping ISCI"
value-field="mappingIsci"
color="#add8e6" />
<DxSeries name="Mapping Product"
value-field="mappingProduct"
color="#ff0000" />
<DxLegend :visible="true" />
<DxTooltip :enabled="true" />
</DxChart>
</div>
</transition>
</b-collapse>
</div>
<!--Grid card-->
<div class="collapse-panel nested-background mb-2 d-flex flex-column w-100 ">
<div class="collapse-bar full-length">
<b-button class="buttonRow w-100 py-0 d-flex justify-content-between" size="sm" variant="link" #click="hideGrids = !hideGrids" v-b-toggle.counts-collapse>
<span class="title">Grids</span>
<icon :class="{'down': hideGrids}" class="icon rotate mt-1" icon="chevron-up" size="lg" />
</b-button>
</div>
<b-collapse id="counts-collapse" visible>
<transition name="fade" mode="out-in">
<dx-tab-panel ref="tabPanel" :items="tabs">
<div slot="title" class="wordwrap" slot-scope="tab">{{tab.data.title}}</div>
<div slot="item" slot-scope="tab">
<span v-if="isTab(tab, 0)">
<data-summary :graphData="graphData"></data-summary>
</span>
<span v-if="isTab(tab, 1)"><user-data :rawData="rawData"></user-data></span>
</div>
</dx-tab-panel>
</transition>
</b-collapse>
</div>
</div>
</div>
</div>
</div>
I need the last table to have an overflow inside the div and not scroll the page. I also need that div to expand if the chart is minimized. I have been trying to solve this all day I'm out of answers, I feel like this should be a super simple fix but I just can't get it.
Thanks for any help!

How do I make dynamic routing work in Vue?

I got a project and when I use :to, my dynamic routes dont work..I also can't seem to pass params. The buttons supposed to be used as dynamic routes are declared in the v-for loop. I am using Quasar CLI / Vue3.
It'd be really awesome if some of you had an insight as to why this does not work. I get no errors, simply, when I hover over the button it shows no url as it normally would in a browser.
The view displaying items:
<template>
<div class="projects">
<div class="text-h3 project-title">
Favourite Projects <q-icon name="star" color="yellow" />
</div>
</div>
<div class="project-container">
<div class="q-pa-md project-card">
<q-card class="my-card single-projects no-shadow no-border-radius">
<q-img
src="https://res.cloudinary.com/practicaldev/image/fetch/s--9yBkqrjS--/c_imagga_scale,f_auto,fl_progressive,h_500,q_auto,w_1000/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nphrgz8yfnjylrwfr0yl.png"
>
<div class="absolute-bottom">
<div class="text-h6">
Damn good project
<q-icon name="star" color="yellow" />
</div>
<div class="text-subtitle2">by Big Boi</div>
</div>
</q-img>
<q-card-actions class="project-btns">
<q-btn
unelevated
size="md"
class="open-btn no-border-radius dropdown-btn"
>Open</q-btn
>
<q-btn
flat
no-caps
unelevated
size="md"
class="delete-btn no-border-radius"
color="red"
#click="confirm = true"
>Delete</q-btn
>
<q-dialog v-model="confirm" persistent class="dialog no-shadow">
<q-card>
<q-card-section class="row items-center">
<span class="q-ml-sm"
>Are you sure you want to delete this project?</span
>
</q-card-section>
<q-card-actions align="center">
<q-btn
flat
no-caps
label="Cancel"
color="black"
class="no-border-radius"
v-close-popup
/>
<q-btn
flat
no-caps
label="Delete"
color="red"
class="no-border-radius"
v-close-popup
/>
</q-card-actions>
</q-card>
</q-dialog>
</q-card-actions>
</q-card>
</div>
</div>
<div class="projects">
<div class="text-h3 project-title">All Projects</div>
</div>
<div v-for="item in items" :key="item.project" class="project-container">
<div class="q-pa-md project-card">
<q-card class="my-card single-projects no-shadow no-border-radius">
<q-img
src="https://res.cloudinary.com/practicaldev/image/fetch/s--9yBkqrjS--/c_imagga_scale,f_auto,fl_progressive,h_500,q_auto,w_1000/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nphrgz8yfnjylrwfr0yl.png"
>
<div class="absolute-bottom">
<div class="text-h6">{{ item.project }}</div>
<div class="text-subtitle2">by {{ item.author }}</div>
</div>
</q-img>
<q-card-actions class="project-btns">
<q-btn
:to="{
name: 'project',
params: {
project: item.project,
},
}"
unelevated
size="md"
class="open-btn no-border-radius dropdown-btn"
>Open
</q-btn>
<q-btn
flat
no-caps
unelevated
size="md"
class="delete-btn no-border-radius"
color="red"
#click="confirm = true"
>Delete</q-btn
>
<q-dialog v-model="confirm" persistent class="dialog no-shadow">
<q-card>
<q-card-section class="row items-center">
<span class="q-ml-sm"
>Are you sure you want to delete this project?</span
>
</q-card-section>
<q-card-actions align="center">
<q-btn
flat
no-caps
label="Cancel"
color="black"
class="no-border-radius"
v-close-popup
/>
<q-btn
flat
no-caps
label="Delete"
color="red"
class="no-border-radius"
v-close-popup
/>
</q-card-actions>
</q-card>
</q-dialog>
</q-card-actions>
</q-card>
</div>
</div>
</template>
<script lang="ts">
import { ref } from 'vue';
export default {
name: 'myProjects',
setup() {
return {
confirm: ref(false),
items: [
{ project: 'good project', id: '302a49g8Aa43', author: 'Josh' },
{ project: 'okay fine', id: '65at9g847a11', author: 'Tray' },
{ project: 'let me see', id: '538s3fg4782f', author: 'Martin' },
],
};
},
};
</script>
This is also my router where I do the routing:
{
path: '/project/:id',
props: true,
component: () => import('layouts/SingleProLayout.vue'),
children: [{ path: '', component: () => import('pages/Project.vue') }],
},
Try wrapping the q-btn inside a router-link https://router.vuejs.org/api/

Get value from v-item-group

I have the following v-item-group where a user can select a pre-defined amount or type himself a custom amount.
Here's the design of the v-item-group. However, I can't figure out how to get the value from Custom Amount. The property this.item is undefined. I thought I need to create another v-model but perhaps there is a simple and straignt-forward solution.
<v-item-group v-model="item">
<v-container>
<v-row>
<v-item v-for="n in amounts" :key="n" v-slot="{ active, toggle }">
<v-card
:color="active ? 'deep-purple accent-3' : 'grey'"
class="d-flex align-center rounded-circle mr-3"
dark
height="64"
width="64"
#click="toggle"
>
<v-scroll-y-transition>
<div v-if="active" class="h3 flex-grow-1 text-center">
{{ n }}
</div>
<div v-else class=" h5 flex-grow-1 text-center">
{{ n }}
</div>
</v-scroll-y-transition>
</v-card>
</v-item>
<v-item v-slot="{ toggle }" key="5">
<v-text-field
label="Custom Amount"
hide-details="auto"
#click="toggle"
></v-text-field>
</v-item>
</v-row>
</v-container>
</v-item-group>
Declare a local data property, and use v-model on v-text-field:
<v-text-field v-model="customAmount">
export default {
data() {
return {
customAmount: '2000'
}
}
}
The function that processes the user's selection could then get the custom value simply by this.customAmount.
demo