Update demo

pull/2667/head
Cagatay Civici 2022-06-14 14:06:35 +03:00
parent 0cbb37d273
commit bd299170b2
3 changed files with 26 additions and 13 deletions

View File

@ -10,7 +10,7 @@
<div class="content-section implementation">
<div class="card">
<Button label="Show" @click="onShow" />
<Button label="Select a Product" icon="pi pi-search" @click="showProducts" />
<DynamicDialog />
</div>
@ -28,13 +28,16 @@ import DynamicDialogDoc from './DynamicDialogDoc.vue';
export default {
methods:{
onShow() {
showProducts() {
const dialogRef = this.$dialog.open(ProductListDemo, {
props: {
header: 'Product List',
style: {
width: '50%',
height: '550px',
width: '50vw',
},
breakpoints:{
'960px': '75vw',
'640px': '90vw'
},
modal: true
},
@ -42,7 +45,7 @@ export default {
footer: () => {
return [
h(Button, { label: "No", icon: "pi pi-times", onClick: () => dialogRef.hide({ buttonType: 'No' }), class: "p-button-text" }),
h(Button, { label: "Yes", icon: "pi pi-check", onClick: () => dialogRef.hide({ buttonType: 'Yes' }), autofocus: true })
h(Button, { label: "Yes", icon: "pi pi-check", onClick: () => dialogRef.hide({ buttonType: 'Yes' }), autofocus: true})
]
}
},

View File

@ -1,7 +1,9 @@
<template>
<div class="flex flex-column align-items-center justify-content-center row-gap-3">
<div>
<p>There are <strong>{{totalProducts}}</strong> products in total in this list.</p>
<Button type="button" label="Close" @click="closeDialog"></Button>
<div class="flex justify-content-end">
<Button type="button" label="Close" @click="closeDialog"></Button>
</div>
</div>
</template>

View File

@ -1,17 +1,25 @@
<template>
<div>
<Button label="Info" icon="pi pi-info-circle" class="p-button-sm p-button-outlined p-button-info my-2" @click="onInfoShow" />
<div class="flex justify-content-end mt-1 mb-3">
<Button icon="pi pi-external-link" label="Nested Dialog" class="p-button-outlined p-button-success" @click="showInfo" />
</div>
<DataTable :value="products" responsiveLayout="scroll">
<Column field="code" header="Code"></Column>
<Column field="name" header="Name"></Column>
<Column header="Image">
<template #body="slotProps">
<img :src="'demo/images/product/' + slotProps.data.image" :alt="slotProps.data.name" class="shadow-2 w-4rem" />
</template>
</Column>
<Column field="category" header="Category"></Column>
<Column field="quantity" header="Quantity"></Column>
<Column>
<Column style="width:5rem">
<template #body="slotProps">
<Button type="button" icon="pi pi-cog" @click="closeDialog(slotProps.data)"></Button>
<Button type="button" icon="pi pi-plus" class="p-button-text p-button-rounded" @click="selectProduct(slotProps.data)"></Button>
</template>
</Column>
</DataTable>
</div>
</template>
@ -31,13 +39,13 @@ export default {
this.productService = new ProductService();
},
mounted() {
this.productService.getProductsSmall().then(data => this.products = data);
this.productService.getProductsSmall().then(data => this.products = data.slice(0,5));
},
methods: {
closeDialog(data) {
selectProduct(data) {
this.dialogRef.hide(data);
},
onInfoShow() {
showInfo() {
this.$dialog.open(InfoDemo, {
props: {
header: 'Information',