mirror of
https://github.com/primefaces/primevue.git
synced 2025-05-10 17:32:36 +00:00
OrderList PickList demo updates
This commit is contained in:
parent
f7943d7b9a
commit
b9700aef2d
6 changed files with 331 additions and 120 deletions
148
doc/picklist/TemplateDoc.vue
Normal file
148
doc/picklist/TemplateDoc.vue
Normal file
|
@ -0,0 +1,148 @@
|
|||
<template>
|
||||
<DocSectionText v-bind="$attrs">
|
||||
<p>For custom content support define an <i>item</i> template that gets the item instance as a parameter. In addition <i>sourceheader</i> and <i>targetheader</i> slots are provided for further customization.</p>
|
||||
</DocSectionText>
|
||||
<div class="card">
|
||||
<PickList v-model="products" dataKey="id" breakpoint="1400px" listStyle="height:342px">
|
||||
<template #sourceheader> Available </template>
|
||||
<template #targetheader> Selected </template>
|
||||
<template #item="{ item }">
|
||||
<div class="flex flex-wrap p-2 align-items-center gap-3">
|
||||
<img class="w-4rem flex-shrink-0 border-round" :src="'https://primefaces.org/cdn/primevue/images/product/' + item.image" :alt="item.name" />
|
||||
<div class="flex-1 flex flex-column gap-2">
|
||||
<span class="font-bold">{{ item.name }}</span>
|
||||
<div class="flex align-items-center gap-2">
|
||||
<i class="pi pi-tag text-sm"></i>
|
||||
<span>{{ item.category }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<span class="font-bold">${{ item.price }}</span>
|
||||
</div>
|
||||
</template>
|
||||
</PickList>
|
||||
</div>
|
||||
<DocSectionCode :code="code" v-bind="$attrs" :service="['ProductService']" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { ProductService } from '@/service/ProductService';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
products: null,
|
||||
code: {
|
||||
basic: `
|
||||
<PickList v-model="products" dataKey="id" breakpoint="1400px">
|
||||
<template #sourceheader> Available </template>
|
||||
<template #targetheader> Selected </template>
|
||||
<template #item="{ item }">
|
||||
<div class="flex flex-wrap p-2 align-items-center gap-3">
|
||||
<img class="w-4rem flex-shrink-0 border-round" :src="'https://primefaces.org/cdn/primevue/images/product/' + item.image" :alt="item.name" />
|
||||
<div class="flex-1 flex flex-column gap-2">
|
||||
<span class="font-bold">{{ item.name }}</span>
|
||||
<div class="flex align-items-center gap-2">
|
||||
<i class="pi pi-tag text-sm"></i>
|
||||
<span>{{ item.category }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<span class="font-bold">$ {{ item.price }}</span>
|
||||
</div>
|
||||
</template>
|
||||
</PickList>
|
||||
`,
|
||||
options: `
|
||||
<template>
|
||||
<div class="card">
|
||||
<PickList v-model="products" dataKey="id" breakpoint="1400px">
|
||||
<template #sourceheader> Available </template>
|
||||
<template #targetheader> Selected </template>
|
||||
<template #item="{ item }">
|
||||
<div class="flex flex-wrap p-2 align-items-center gap-3">
|
||||
<img class="w-4rem flex-shrink-0 border-round" :src="'https://primefaces.org/cdn/primevue/images/product/' + item.image" :alt="item.name" />
|
||||
<div class="flex-1 flex flex-column gap-2">
|
||||
<span class="font-bold">{{ item.name }}</span>
|
||||
<div class="flex align-items-center gap-2">
|
||||
<i class="pi pi-tag text-sm"></i>
|
||||
<span>{{ item.category }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<span class="font-bold">$ {{ item.price }}</span>
|
||||
</div>
|
||||
</template>
|
||||
</PickList>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { ProductService } from '@/service/ProductService'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
products: null
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
ProductService.getProductsSmall().then((data) => (this.products = [data, []]));
|
||||
}
|
||||
};
|
||||
<\/script>
|
||||
`,
|
||||
composition: `
|
||||
<template>
|
||||
<div class="card">
|
||||
<PickList v-model="products" dataKey="id" breakpoint="1400px">
|
||||
<template #sourceheader> Available </template>
|
||||
<template #targetheader> Selected </template>
|
||||
<template #item="{ item }">
|
||||
<div class="flex flex-wrap p-2 align-items-center gap-3">
|
||||
<img class="w-4rem flex-shrink-0 border-round" :src="'https://primefaces.org/cdn/primevue/images/product/' + item.image" :alt="item.name" />
|
||||
<div class="flex-1 flex flex-column gap-2">
|
||||
<span class="font-bold">{{ item.name }}</span>
|
||||
<div class="flex align-items-center gap-2">
|
||||
<i class="pi pi-tag text-sm"></i>
|
||||
<span>{{ item.category }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<span class="font-bold">$ {{ item.price }}</span>
|
||||
</div>
|
||||
</template>
|
||||
</PickList>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue';
|
||||
import { ProductService } from '@/service/ProductService'
|
||||
|
||||
const products = ref(null);
|
||||
|
||||
onMounted(() => {
|
||||
ProductService.getProductsSmall().then((data) => (products.value = [data, []]));
|
||||
});
|
||||
<\/script>
|
||||
`,
|
||||
data: `
|
||||
/* ProductService */
|
||||
{
|
||||
id: '1000',
|
||||
code: 'f230fh0g3',
|
||||
name: 'Bamboo Watch',
|
||||
description: 'Product Description',
|
||||
image: '/bamboo-watch.jpg',
|
||||
price: 65,
|
||||
category: 'Accessories',
|
||||
quantity: 24,
|
||||
inventoryStatus: 'INSTOCK',
|
||||
rating: 5
|
||||
},
|
||||
...
|
||||
`
|
||||
}
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
ProductService.getProductsSmall().then((data) => (this.products = [data, []]));
|
||||
}
|
||||
};
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue