美文网首页
三种状态进行判断

三种状态进行判断

作者: 琳媚儿 | 来源:发表于2020-08-29 12:00 被阅读0次

通过type参数名,将input,output 返给后端

捕获.PNG

首先定义一个变量pay; v-if=pay==' ' 默认全部显示,v-if=pay=='input'点击只看收入;v-if=pay=='output'点击只看支出把

<div class="wallet_center_right">
                        <image v-if="pay=='input'" src="/static/icon/icon_xuanzhong1@2x.png" class="wallet_center_icon" @click="changeAll_input"></image>
                        <image v-else src="/static/icon/wei@2x.png" mode="" class="wallet_center_icon" @click="change_input"></image>
                        <div style="margin-right: 38rpx;">只看收入</div>
                    </div>
                    <div class="wallet_center_right">
                        <image v-if="pay=='output'" src="/static/icon/icon_xuanzhong1@2x.png" class="wallet_center_icon" @click="changeAll_input"></image>
                        <image v-else src="/static/icon/wei@2x.png" mode="" class="wallet_center_icon" @click="change_output"></image>
                        <div>只看支出</div>
                    </div>
<!-- 支出列表 -->
        <div class="wallet_list" v-for="(item,index) in recordList" :key="index">
            <!-- 默认显示全部 -->

            <div class="wallet_item" v-if="pay==''">
                <image src="/static/icon/zhuchu@2x.png" mode="" style="width: 50rpx;height: 50rpx;"></image>
                <div class="wallet_item_cen">
                    <div class="wallet_item_name">{{item.remark|nameFilter}}</div>
                    <div style="font-size: 24rpx;color: #999999;height:20rpx ;margin-top: 20rpx;"><span style="margin-right: 8rpx;">{{item.created_at}}
                        </span>
                    </div>
                </div>
                <div style="font-size: 32rpx;color: #333333;font-weight: 500;">
                    {{item.amount}}
                </div>
            </div>

            <!-- 支出列表 -->
            <div v-if="pay=='output'">
        
            </div>
            <!-- 收入表 -->
            <div v-if="pay=='input'">
            </div>
        </div>

type: this.pay + ' ' 将变量转化成字符串传给后端

  data(){
          return{    
                   pay: '', //默认为空查看全部,input时看支出,output看收入
            }
       },
methods:{
        getApiUserPortalEmsStaffPurseRecordGetListByCon() {
                this.$api.userPortal_emsStaffPurseRecord_getListByCon({
                    type: this.pay + ' ',
                }).then(res => {
                   this.recordList = res.data.data.data 
            })
        },
            // output支出
            change_output() {
                this.pay = 'output';
                console.log(" output支出")
            },
            // input收入
            change_input() {
                this.pay = 'input';
                console.log("input收入")
            },
            //继续查看全部
            changeAll_input() {
                this.pay = '';
            },
      }
捕获.PNG

相关文章

  • 三种状态进行判断

    通过type参数名,将input,output 返给后端 首先定义一个变量pay; v-if=pay==' ' 默...

  • 网络判断

    在进行数据连接时候需要进行网络状态判断 //判断网络连接 + (BOOL) isConnectionAvailab...

  • if判断

    if判断有三种: 第一种:单个if语句进行判断 if(条件){ js执行代码 } 第二种:if..else判断 i...

  • 【promise-04】Promise的三种状态

    #Promise的三种状态 pending - 进行中 fulfilled - 成功 rejected - 失败...

  • python-基础篇02

    程序的三种基本结构: 选择结构:根据选择条件 进行判断 并且根据判断结构选择要执行的程序语句会改变程序的执行流程 ...

  • ES6之promise

    难点一:promise的状态 promise是一个容器,它具有三种状态 (进行中)(成功)<...

  • Promise、Generator、Async三者的区别

    Promise有三种状态:pending(进行中)、resolved(成功)、rejected(失败) Promi...

  • ES6: Promise函数

    Promise的三种状态Pending:进行中 | Resolved(已完成)|Rejected(已失败) 例子 ...

  • JVM之判断对象的存活状态

    jvm垃圾收集器在进行垃圾回收时,会判断对象是否存活状态,只有死去的对象才会被回收。那么怎么判断对象的存活状态呢?...

  • 吸引力法则

    三种状态: 意识:分别心,推理,判断分析,道理,权谋,技术,手段。 潜意识:信念,理想,情绪,偏执。 阿赖耶识:观...

网友评论

      本文标题:三种状态进行判断

      本文链接:https://www.haomeiwen.com/subject/guwdsktx.html