2023-02-28 08:29:30 +00:00
|
|
|
<template>
|
|
|
|
<DocSectionText v-bind="$attrs">
|
2024-05-30 11:10:35 +00:00
|
|
|
<p>OrderList requires an array as its value bound with the <i>v-model</i> directive and <i>option</i> template for its content.</p>
|
2023-02-28 08:29:30 +00:00
|
|
|
</DocSectionText>
|
2024-05-30 00:00:20 +00:00
|
|
|
<div class="card sm:flex sm:justify-center">
|
|
|
|
<OrderList v-model="products" dataKey="id" breakpoint="575px" pt:pcList:root="w-full sm:w-56">
|
2024-05-30 11:10:35 +00:00
|
|
|
<template #option="{ option }">
|
|
|
|
{{ option.name }}
|
2023-02-28 08:29:30 +00:00
|
|
|
</template>
|
|
|
|
</OrderList>
|
|
|
|
</div>
|
|
|
|
<DocSectionCode :code="code" v-bind="$attrs" :service="['ProductService']" />
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { ProductService } from '@/service/ProductService';
|
2024-04-02 08:38:38 +00:00
|
|
|
|
2023-02-28 08:29:30 +00:00
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
products: null,
|
|
|
|
code: {
|
2023-09-22 12:54:14 +00:00
|
|
|
basic: `
|
2024-05-30 00:00:20 +00:00
|
|
|
<OrderList v-model="products" dataKey="id" breakpoint="575px" pt:pcList:root="w-full sm:w-56">
|
2024-05-30 11:10:35 +00:00
|
|
|
<template #option="{ option }">
|
|
|
|
{{ option.name }}
|
2023-02-28 08:29:30 +00:00
|
|
|
</template>
|
2023-10-15 09:38:39 +00:00
|
|
|
</OrderList>
|
|
|
|
`,
|
2023-09-22 12:54:14 +00:00
|
|
|
options: `
|
|
|
|
<template>
|
2024-05-30 00:00:20 +00:00
|
|
|
<div class="card sm:flex sm:justify-center">
|
|
|
|
<OrderList v-model="products" dataKey="id" breakpoint="575px" pt:pcList:root="w-full sm:w-56">
|
2024-05-30 11:10:35 +00:00
|
|
|
<template #option="{ option }">
|
|
|
|
{{ option.name }}
|
2023-02-28 08:29:30 +00:00
|
|
|
</template>
|
|
|
|
</OrderList>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { ProductService } from '@/service/ProductService'
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
products: null
|
|
|
|
}
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
ProductService.getProductsSmall().then((data) => (this.products = data));
|
|
|
|
}
|
|
|
|
};
|
2023-10-15 09:38:39 +00:00
|
|
|
<\/script>
|
|
|
|
`,
|
2023-09-22 12:54:14 +00:00
|
|
|
composition: `
|
|
|
|
<template>
|
2024-05-30 00:00:20 +00:00
|
|
|
<div class="card sm:flex sm:justify-center">
|
|
|
|
<OrderList v-model="products" dataKey="id" breakpoint="575px" pt:pcList:root="w-full sm:w-56">
|
2024-05-30 11:10:35 +00:00
|
|
|
<template #option="{ option }">
|
|
|
|
{{ option.name }}
|
2023-02-28 08:29:30 +00:00
|
|
|
</template>
|
|
|
|
</OrderList>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
import { ref, onMounted } from 'vue';
|
|
|
|
import { ProductService } from '@/service/ProductService'
|
|
|
|
|
|
|
|
const products = ref(null);
|
|
|
|
|
|
|
|
onMounted(() => {
|
2023-07-27 06:42:04 +00:00
|
|
|
ProductService.getProductsSmall().then((data) => (products.value = data));
|
2023-02-28 08:29:30 +00:00
|
|
|
});
|
2023-10-15 09:38:39 +00:00
|
|
|
<\/script>
|
|
|
|
`,
|
2023-02-28 08:29:30 +00:00
|
|
|
data: `
|
2024-04-02 08:38:38 +00:00
|
|
|
/* ProductService */
|
2023-02-28 08:29:30 +00:00
|
|
|
{
|
|
|
|
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>
|