Update demo
parent
0cbb37d273
commit
bd299170b2
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
<div class="content-section implementation">
|
<div class="content-section implementation">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<Button label="Show" @click="onShow" />
|
<Button label="Select a Product" icon="pi pi-search" @click="showProducts" />
|
||||||
|
|
||||||
<DynamicDialog />
|
<DynamicDialog />
|
||||||
</div>
|
</div>
|
||||||
|
@ -28,13 +28,16 @@ import DynamicDialogDoc from './DynamicDialogDoc.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
methods:{
|
methods:{
|
||||||
onShow() {
|
showProducts() {
|
||||||
const dialogRef = this.$dialog.open(ProductListDemo, {
|
const dialogRef = this.$dialog.open(ProductListDemo, {
|
||||||
props: {
|
props: {
|
||||||
header: 'Product List',
|
header: 'Product List',
|
||||||
style: {
|
style: {
|
||||||
width: '50%',
|
width: '50vw',
|
||||||
height: '550px',
|
},
|
||||||
|
breakpoints:{
|
||||||
|
'960px': '75vw',
|
||||||
|
'640px': '90vw'
|
||||||
},
|
},
|
||||||
modal: true
|
modal: true
|
||||||
},
|
},
|
||||||
|
@ -42,7 +45,7 @@ export default {
|
||||||
footer: () => {
|
footer: () => {
|
||||||
return [
|
return [
|
||||||
h(Button, { label: "No", icon: "pi pi-times", onClick: () => dialogRef.hide({ buttonType: 'No' }), class: "p-button-text" }),
|
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})
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
<template>
|
<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>
|
<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>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,25 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<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">
|
<DataTable :value="products" responsiveLayout="scroll">
|
||||||
<Column field="code" header="Code"></Column>
|
<Column field="code" header="Code"></Column>
|
||||||
<Column field="name" header="Name"></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="category" header="Category"></Column>
|
||||||
<Column field="quantity" header="Quantity"></Column>
|
<Column field="quantity" header="Quantity"></Column>
|
||||||
<Column>
|
<Column style="width:5rem">
|
||||||
<template #body="slotProps">
|
<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>
|
</template>
|
||||||
</Column>
|
</Column>
|
||||||
</DataTable>
|
</DataTable>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -31,13 +39,13 @@ export default {
|
||||||
this.productService = new ProductService();
|
this.productService = new ProductService();
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.productService.getProductsSmall().then(data => this.products = data);
|
this.productService.getProductsSmall().then(data => this.products = data.slice(0,5));
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
closeDialog(data) {
|
selectProduct(data) {
|
||||||
this.dialogRef.hide(data);
|
this.dialogRef.hide(data);
|
||||||
},
|
},
|
||||||
onInfoShow() {
|
showInfo() {
|
||||||
this.$dialog.open(InfoDemo, {
|
this.$dialog.open(InfoDemo, {
|
||||||
props: {
|
props: {
|
||||||
header: 'Information',
|
header: 'Information',
|
||||||
|
|
Loading…
Reference in New Issue