0
我想在我的視圖中做濾鏡和分頁 - 候選人頁面..我想顯示候選人根據名稱和經驗和預期ctc ..我想顯示候選人.. 誰能幫我該怎麼做,在vuejs ...如何在vuejs中做濾鏡和分頁
這是我的看法,candidates.blade.php
<div class="container">
<div class="row">
<el-row :gutter="12">
<el-col>
<p>View Candidates</p>
</el-col>
</el-row>
<el-row :gutter="12">
<template v-for="c in candidates">
<el-col :span="6">
<Candidate :c="c" :key="c.id"></Candidate>
</el-col>
</template>
</el-row>
</div>
這裏是我的看法,candidates.js頁:
import Candidate from './components/Candidate.vue';
const app = new Vue({
el: '#app',
data() {
return {
candidates: window.data.candidates,
sortKey : 'first_name'
}
},
components: { Candidate },
});
這裏是我的candidate.vue頁:
<template>
<ElCard>
<div slot="header">
<strong>
{{c.first_name.toUpperCase() + ' ' + c.last_name.toUpperCase()}}
<br />
<small>{{c.role}} - {{c.experience}} Years</small>
</strong>
</div>
<p><strong>{{c.contact_no}} : {{c.email}}</strong></p>
<p>
<strong>Currently at:</strong> {{c.current_location}}
<br />
<strong>Ready to move:</strong> {{c.desired_location}}
</p>
<ElButton type="primary" size="small" @click="ResumeDialog = true">VIEW RESUME</ElButton>
<ElDialog class="text-left" :title="c.first_name.toUpperCase() + ' ' + c.last_name.toUpperCase()" v-model="ResumeDialog">
<p><strong>{{c.role}} - {{c.experience}} Years</strong></p>
<p>
<strong>Currently at:</strong> {{c.current_location}}
<br />
<strong>Ready to move:</strong> {{c.desired_location}}
</p>
<p>{{c.resume}}</p>
<br />
<p><strong>{{c.contact_no}} : {{c.email}}</strong></p>
</ElDialog>
</ElCard>
//腳本
import { Button as ElButton, Dialog as ElDialog, Card as ElCard } from 'element-ui';
import axios from 'axios';
export default {
props: ['c'],
data() {
return {
ResumeDialog: false,
}
},
components: { ElButton, ElDialog, ElCard },
}
誰能幫我該怎麼做..
TIA。 。
多數民衆贊成它?或者我們需要在另一個網頁上寫任何代碼? – user3663
@ user3663我已添加頁面按鈕機制。這很簡單。你只需要計算numOfCandidates/itemsPerPage四捨五入的頁數(ceil func)。接下來你需要創建循環的numPages次。然後setPage方法綁定到每個按鈕。 (頁面的數量需要降低,因爲它的按鈕1,但我們需要索引從0) –
我得到這個錯誤使用未定義的常量n - 假設'n' – user3663