<v-selectpage data="/api/intrusionevent/lists" v-model="temp.event_id" key-field="id" show-field="description" search-field="description" :result-format="selectResultFormat" :params="{ search: 1 }" > </v-selectpage>
methods: { selectResultFormat(resp){ const res = resp.data let obj = { totalRow:res.data.count, list:res.data.list } return obj }, }
main.js
import vSelectPage from 'v-selectpage' Vue.use(vSelectPage, { // server side data loader dataLoad: function(vue, data, params) { const { pageNumber, pageSize, } = params; if (pageNumber) { params.page = pageNumber delete params.pageNumber } if (pageSize) { params.limit = pageSize delete params.pageSize } return new Promise((resolve, reject) => { axios.get(data, {params: params}).then(resp => resolve(resp), resp => reject(resp)); }); } })
标签:插件,pageSize,resp,params,vue2,pageNumber,selectpage,data From: https://www.cnblogs.com/felixwan/p/17972807