| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- <template>
- <page-theme :theme="theme">
- <template>
- <view class="f-30 p-t-20 p-b-20">
- <view class="col-info-d t-c m-b-30">搜索框</view>
- <u-list @scrolltolower="scrolltolower">
- <u-list-item v-for="(item, index) in list" :key="index">
- <u-cell :title="item.name" @click="toDetail(item.id)">
- <u-avatar slot="icon" shape="square" size="35" :src="item.cover"
- customStyle="margin: -3px 5px -3px 0"></u-avatar>
- </u-cell>
- </u-list-item>
- </u-list>
- </view>
- </template>
- </page-theme>
- </template>
- <script>
- import themeMixins from '@/pages/yuecai/mixins/themeMixins.js';
- export default {
- mixins: [themeMixins],
- data() {
- return {
- page: {
- current: 1,
- size: 10,
- total: 0
- },
- searchKey: '',
- list: []
- }
- },
- methods: {
- doSearch() {
- this.page.current = 1;
- this.list = [];
- this.getDishList();
- },
- scrolltolower() {
- this.loadmore()
- },
- loadmore() {
- this.page.current++;
- this.getDishList();
- },
- getRestaurantList() {
- this.$u.api.getRestaurantList().then(res => {
- if (res.data.records && res.data.records.length > 0) {
- this.list.push(...res.data.records)
- }
- this.page.total = res.data.total || 0;
- })
- },
- toDetail(id) {
- uni.navigateTo({
- url: "/pages/yuecai/restaurant/detail/index?id=" + id
- })
- }
- },
- onLoad(options) {
- this.getRestaurantList()
- },
- }
- </script>
- <style scoped lang="scss">
- </style>
|