primevue-mirror/doc/inplace/LazyDoc.vue

114 lines
3.3 KiB
Vue
Raw Normal View History

2023-02-28 08:29:30 +00:00
<template>
<DocSectionText v-bind="$attrs">
<p>Using the <i>open</i> event, data can be loaded in a lazy manner before displaying it in a table.</p>
</DocSectionText>
<div class="card">
<Inplace @open="loadData">
<template #display> View Data </template>
<template #content>
<DataTable :value="products">
<Column field="code" header="Code"></Column>
<Column field="name" header="Name"></Column>
<Column field="category" header="Category"></Column>
<Column field="quantity" header="Quantity"></Column>
</DataTable>
</template>
</Inplace>
</div>
<DocSectionCode :code="code" :service="['ProductService']" />
</template>
<script>
import { ProductService } from '@/service/ProductService';
export default {
data() {
return {
products: null,
code: {
2023-09-22 12:54:14 +00:00
basic: `
<Inplace @open="loadData">
2023-02-28 08:29:30 +00:00
<template #display> View Data </template>
<template #content>
<DataTable :value="products">
<Column field="code" header="Code"></Column>
<Column field="name" header="Name"></Column>
<Column field="category" header="Category"></Column>
<Column field="quantity" header="Quantity"></Column>
</DataTable>
</template>
2023-10-15 09:38:39 +00:00
</Inplace>
`,
2023-09-22 12:54:14 +00:00
options: `
<template>
2023-02-28 08:29:30 +00:00
<div class="card">
<Inplace @open="loadData">
<template #display> View Data </template>
<template #content>
<DataTable :value="products">
<Column field="code" header="Code"></Column>
<Column field="name" header="Name"></Column>
<Column field="category" header="Category"></Column>
<Column field="quantity" header="Quantity"></Column>
</DataTable>
</template>
</Inplace>
</div>
</template>
<script>
import {ProductService} from '@/service/ProductService';
export default {
data() {
return {
products: null
}
},
methods: {
loadData() {
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>
2023-02-28 08:29:30 +00:00
<div class="card">
<Inplace @open="loadData">
<template #display> View Data </template>
<template #content>
<DataTable :value="products">
<Column field="code" header="Code"></Column>
<Column field="name" header="Name"></Column>
<Column field="category" header="Category"></Column>
<Column field="quantity" header="Quantity"></Column>
</DataTable>
</template>
</Inplace>
</div>
</template>
<script setup>
import { ref } from "vue";
import {ProductService} from "@/service/ProductService";
const products = ref();
const loadData = () => {
ProductService.getProductsSmall().then((data) => (products.value = data));
}
2023-10-15 09:38:39 +00:00
<\/script>
`
2023-02-28 08:29:30 +00:00
}
};
},
methods: {
loadData() {
ProductService.getProductsSmall().then((data) => (this.products = data));
}
}
};
</script>