zoukankan      html  css  js  c++  java
  • 点击早中晚 分别进不同的详情

      computed: {
                _dataList: function() {
    
                    if (this.type == 1)
                        return this.dataList.breakfast
                    if (this.type == 2)
                        return this.dataList.lunch
                    if (this.type == 3)
                        return this.dataList.dinner
    
                    return []
                },
                loading: function() {
                    var that: any = this;
                    return that.refreshing || that.loadmoreing;
                }
            },
                  <view class="item" hover-class="zk_pressed1" v-for="(item,index) in _dataList" :key="index">
                                <myimage class="img" :src="item.images"></myimage>
                                <view class="title">{{item.name}}</view>
                                <view class="bottom">
                                    <view class="left">
                                        <text>{{item.weight}}</text>
                                    </view>
                                    <view class="right">
                                        <text>{{item.calorie}}千卡</text>
                                    </view>
                                </view>
                            </view>
    onLoad() {
                var that: any = getApp();
                this.contentMarginTop = that.globalData.immersionAppBarHeight
    
                var _pages: any = getCurrentPages()
    
                var _date: any = _pages[_pages.length - 1].options.date || this.$Route.query.date
                this.type = _pages[_pages.length - 1].options.type || this.$Route.query.type
    
                this.getDayRecipes(_date)
            },

    dining

                <view class="menuItem zk_pressed1" @click="itemMore(weeks[curWeekIndex].date,1)">
                                <view class="header">
                                    <text style="flex:1;font-size: 18px;font-weight: bold;">早餐</text>
                                    <text style="font-size: 10px;">更多</text>
                                </view>
                                <view style="display: flex;">
                                    <view class="itmm" v-for="item in breakfast" :key="index">
                                        <!-- <image src="/static/logo.png"></image>  -->
                                        <myimage class="image" :src="item.images"></myimage>
                                        <view class="txt">
                                            <view style="font-size: 12px;">{{item.name}}</view>
                                            <view style="font-size: 9px;color: #999999;margin: 2px 0;">{{item.weight}}</view>
                                            <view style="font-size: 9px;color: #999999;">{{item.calorie}}</view>
                                        </view>
                                    </view>
                                </view>
                            </view>
                            <view class="menuItem zk_pressed1" @click="itemMore(weeks[curWeekIndex].date,2)">
                                <view class="header">
                                    <text style="flex:1;font-size: 18px;font-weight: bold;">午餐</text>
                                    <text style="font-size: 10px;">更多</text>
                                </view>
                                <view style="display: flex;">
                                    <view class="itmm" v-for="item in lunch" :key="index">
                                        <!-- <image src="/static/logo.png"></image>  -->
                                        <myimage class="image" :src="item.images"></myimage>
                                        <view class="txt">
                                            <view style="font-size: 12px;">{{item.name}}</view>
                                            <view style="font-size: 9px;color: #999999;margin: 2px 0;">{{item.weight}}</view>
                                            <view style="font-size: 9px;color: #999999;">{{item.calorie}}</view>
                                        </view>
                                    </view>
                                </view>
                            </view>
                            <view class="menuItem zk_pressed1" @click="itemMore(weeks[curWeekIndex].date,3)">
                                <view class="header">
                                    <text style="flex:1;font-size: 18px;font-weight: bold;">晚餐</text>
                                    <text style="font-size: 10px;">更多</text>
                                </view>
                                <view style="display: flex;">
                                    <view class="itmm" v-for="item in dinner" :key="index">
                                        <!-- <image src="/static/logo.png"></image>  -->
                                        <myimage class="image" :src="item.images"></myimage>
                                        <view class="txt">
                                            <view style="font-size: 12px;">{{item.name}}</view>
                                            <view style="font-size: 9px;color: #999999;margin: 2px 0;">{{item.weight}}</view>
                                            <view style="font-size: 9px;color: #999999;">{{item.calorie}}</view>
                                        </view>
                                    </view>
                                </view>
                            </view>
    data() {
                return {
                    // 是否展示 导航栏 阴影
                    immersionShow: false,
                    contentMarginTop: 0,
                    curWeekIndex: 0,
                    currentData: [],
                    list: [],
                    meal_type: 1,
                    time: null,
                    breakfast_time: "未设置",
                    lunch_time: "未设置",
                    dinner_time: "未设置",
                    a: 0,
                    b: 0,
                    c: 0,
                    breakfast: [],
                    lunch: [],
                    dinner: [],
                    total: [],
                    weeks: [{
                            display: "周天",
                            date: ""
                        },
                        {
                            display: "周一",
                            date: ""
                        },
                        {
                            display: "周二",
                            date: ""
                        },
                        {
                            display: "周三",
                            date: ""
                        },
                        {
                            display: "周四",
                            date: ""
                        },
                        {
                            display: "周五",
                            date: ""
                        },
                        {
                            display: "周六",
                            date: ""
                        }
                    ]
    
                }
            },
     method 从dining页传type123到dining详情 

    itemMore(date: String, type: Number) {
    this.$Router.push({ name: 'health-dining-detail', params: { date: date, type: type } }) },
  • 相关阅读:
    docker命令
    IntelliJ IDEA设置JVM运行参数
    SpringResourceBundleMessageSource示例(转)
    通过ApplicationContextAware加载Spring上下文环境(转)
    @ControllerAdvice + @ExceptionHandler 全局处理 Controller 层异常(转)
    SpringBoot学习(十一)创建自己的自动配置和Kotlin支持
    SpringBoot学习(十)Spring集成、会话、(监视和管理JMX)、WebSockets和web服务
    BindingResult不能获取错误对象
    SpringBoot学习(九)使用JTA的分布式事务、Hazelcast、Quartz调度器和任务执行和调度
    Maven项目中pom文件分析
  • 原文地址:https://www.cnblogs.com/lsongyang/p/13577347.html
Copyright © 2011-2022 走看看