112 lines
3.6 KiB
Vue
112 lines
3.6 KiB
Vue
<template>
|
|
<DocSectionText v-bind="$attrs">
|
|
<p>Pagination is enabled by adding <i>paginator</i> property and defining <i>rows</i> per page.</p>
|
|
</DocSectionText>
|
|
<div class="card">
|
|
<DataTable :value="customers" paginator :rows="5" :rowsPerPageOptions="[5, 10, 20, 50]" tableStyle="min-width: 50rem">
|
|
<Column field="name" header="Name" style="width: 25%"></Column>
|
|
<Column field="country.name" header="Country" style="width: 25%"></Column>
|
|
<Column field="company" header="Company" style="width: 25%"></Column>
|
|
<Column field="representative.name" header="Representative" style="width: 25%"></Column>
|
|
</DataTable>
|
|
</div>
|
|
<DocSectionCode :code="code" :service="['CustomerService']" />
|
|
</template>
|
|
|
|
<script>
|
|
import { CustomerService } from '@/service/CustomerService';
|
|
|
|
export default {
|
|
data() {
|
|
return {
|
|
customers: null,
|
|
code: {
|
|
basic: `
|
|
<DataTable :value="customers" paginator :rows="5" :rowsPerPageOptions="[5, 10, 20, 50]" tableStyle="min-width: 50rem">
|
|
<Column field="name" header="Name" style="width: 25%"></Column>
|
|
<Column field="country.name" header="Country" style="width: 25%"></Column>
|
|
<Column field="company" header="Company" style="width: 25%"></Column>
|
|
<Column field="representative.name" header="Representative" style="width: 25%"></Column>
|
|
</DataTable>
|
|
`,
|
|
options: `
|
|
<template>
|
|
<div class="card">
|
|
<DataTable :value="customers" paginator :rows="5" :rowsPerPageOptions="[5, 10, 20, 50]" tableStyle="min-width: 50rem">
|
|
<Column field="name" header="Name" style="width: 25%"></Column>
|
|
<Column field="country.name" header="Country" style="width: 25%"></Column>
|
|
<Column field="company" header="Company" style="width: 25%"></Column>
|
|
<Column field="representative.name" header="Representative" style="width: 25%"></Column>
|
|
</DataTable>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { CustomerService } from '@/service/CustomerService';
|
|
|
|
export default {
|
|
data() {
|
|
return {
|
|
customers: null
|
|
};
|
|
},
|
|
mounted() {
|
|
CustomerService.getCustomersMedium().then((data) => (this.customers = data));
|
|
}
|
|
};
|
|
<\/script>
|
|
`,
|
|
composition: `
|
|
<template>
|
|
<div class="card">
|
|
<DataTable :value="customers" paginator :rows="5" :rowsPerPageOptions="[5, 10, 20, 50]" tableStyle="min-width: 50rem">
|
|
<Column field="name" header="Name" style="width: 25%"></Column>
|
|
<Column field="country.name" header="Country" style="width: 25%"></Column>
|
|
<Column field="company" header="Company" style="width: 25%"></Column>
|
|
<Column field="representative.name" header="Representative" style="width: 25%"></Column>
|
|
</DataTable>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup>
|
|
import { ref, onMounted } from 'vue';
|
|
import { CustomerService } from '@/service/CustomerService';
|
|
|
|
onMounted(() => {
|
|
CustomerService.getCustomersMedium().then((data) => (customers.value = data));
|
|
});
|
|
|
|
const customers = ref();
|
|
|
|
<\/script>
|
|
`,
|
|
data: `
|
|
{
|
|
id: 1000,
|
|
name: 'James Butt',
|
|
country: {
|
|
name: 'Algeria',
|
|
code: 'dz'
|
|
},
|
|
company: 'Benton, John B Jr',
|
|
date: '2015-09-13',
|
|
status: 'unqualified',
|
|
verified: true,
|
|
activity: 17,
|
|
representative: {
|
|
name: 'Ioni Bowcher',
|
|
image: 'ionibowcher.png'
|
|
},
|
|
balance: 70663
|
|
},
|
|
...
|
|
`
|
|
}
|
|
};
|
|
},
|
|
mounted() {
|
|
CustomerService.getCustomersMedium().then((data) => (this.customers = data));
|
|
}
|
|
};
|
|
</script>
|