Commit f439748f authored by DongRuifen's avatar DongRuifen

触底加载

parent 862bfe50
<template> <template>
<view class=""> <view class="">
<u-navbar :is-back="true" :custom-back="backPush" :background="{ backgroundColor: '#F5F5F5' }" title="我的面料"></u-navbar> <u-navbar :is-back="true" :custom-back="backPush" :background="{ backgroundColor: '#F5F5F5' }" title="我的面料">
</u-navbar>
<view class="content background_fff u-p-30"> <view class="content background_fff u-p-30">
<!-- 正文内容 --> <!-- 正文内容 -->
<u-sticky offset-top="15"> <u-sticky offset-top="15">
<u-search @search="searchCli" class="" bg-color="#fff" border-color="#ececec" placeholder="请输入面料名称" :show-action="false" v-model="search"></u-search> <u-search @search="searchCli" class="" bg-color="#fff" border-color="#ececec" placeholder="请输入面料名称"
:show-action="false" v-model="search"></u-search>
</u-sticky> </u-sticky>
<view> <view>
<view class="u-m-t-30"> <view class="u-m-t-30">
...@@ -18,18 +20,22 @@ ...@@ -18,18 +20,22 @@
</template> </template>
<script> <script>
import home from './mixin/index.js' import home from './mixin/index.js'
import fabricTitle from "./components/fabricTitle.vue" import fabricTitle from "./components/fabricTitle.vue"
export default { export default {
mixins:[home], mixins: [home],
components:{fabricTitle}, components: {
fabricTitle
},
data() { data() {
return { return {
size: 10, size: 10,
search: '', search: '',
fiabricList: [], fiabricList: [],
// dataList:[], // dataList:[],
total: 0 total: 0,
current: 1,
isLoad: false,
}; };
}, },
onLoad() { onLoad() {
...@@ -49,14 +55,18 @@ export default { ...@@ -49,14 +55,18 @@ export default {
onReachBottom() { onReachBottom() {
// console,log("jiazai") // console,log("jiazai")
if (this.total > this.fiabricList.length) { if (this.total > this.fiabricList.length) {
this.size = this.size + 5; // this.size = this.size + 5;
this.current += 1
this.materialList(); this.materialList();
} }
}, },
methods: { methods: {
searchCli() { searchCli() {
// this.size = 5; // this.size = 5;
this.current = 1
this.isLoad = true
this.materialList(); this.materialList();
}, },
// 我的面料 // 我的面料
materialList() { materialList() {
...@@ -74,18 +84,29 @@ export default { ...@@ -74,18 +84,29 @@ export default {
this.$http('materialinfo.getMaterialList', { this.$http('materialinfo.getMaterialList', {
size: this.size, size: this.size,
materialCode: '', materialCode: '',
"current": 1, "current": this.current,
"materialType": "面料", "materialType": "面料",
codeAndName: this.search codeAndName: this.search
}).then(res => { }).then(res => {
let { code, data } = res; let {
code,
data
} = res;
if (code == 200) { if (code == 200) {
// 搜索
if (this.isLoad) {
console.log("load")
this.fiabricList = []
this.fiabricList = data.page.records; this.fiabricList = data.page.records;
this.isLoad = false
} else {
this.fiabricList = this.fiabricList.concat(data.page.records);
}
this.total = data.page.total; this.total = data.page.total;
} }
}); });
}, },
backPush(){ backPush() {
this.$Router.push({ this.$Router.push({
path: "/pages/home/index", path: "/pages/home/index",
// query: { // query: {
...@@ -94,11 +115,11 @@ export default { ...@@ -94,11 +115,11 @@ export default {
}) })
} }
} }
}; };
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.background_fff { .background_fff {
background: #fff; background: #fff;
} }
</style> </style>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment