|
|
- <template>
- <scroll-view
- scroll-y="true"
- :style="{height: height}"
- @scrolltolower="loadMoreData">
- <view class="bossList">
- <view
- @click="$utils.navigateTo('/pages_order/boss/bossDetail?id=' + 123)"
- :key="index"
- v-for="(item, index) in list">
- <bossItem :item="item"/>
- </view>
- </view>
- </scroll-view>
- </template>
-
- <script>
- import bossItem from './bossItem.vue'
- export default {
- components : {
- bossItem,
- },
- props : {
- height : {
- default : 'auto'
- },
- api : {
- default : ''
- },
- },
- data() {
- return {
- queryParams: {
- pageNo: 1,
- pageSize: 10,
- },
- total : 0,
- list : [],
- }
- },
- methods: {
- getData(){
- if(uni.getStorageSync('token')){
- this.queryParams.token = uni.getStorageSync('token')
- }
-
- this.$api(this.api, this.queryParams, res => {
- if(res.code == 200){
- this.list = res.result.records || res.result
- this.total = res.result.total || res.result.length
- }
- })
- },
- loadMoreData(){
- if(this.queryParams.pageSize <= this.list.length){
- this.queryParams.pageSize += 10
- this.getData()
- }
- },
- }
- }
- </script>
-
- <style scoped lang="scss">
- .bossList {
- &>view{
- margin: 20rpx;
- }
- }
- </style>
|