zoukankan      html  css  js  c++  java
  • vue-scroller

               <scroller
                class="scroller" 
                :on-infinite="infinite"
                ref="scroller"
                >
                <div v-for="(item,index) in list" :key="index"  class="list">
                        <span>
                            <!-- 价格为空并且不是在编辑模式下 绑定上disabled -->
                            <input type="checkbox" :disabled="!showSetPrice&&!item.price" :id="'a'+index" v-model="item.checked">
                            <label :for="'a'+index" @click="dialogTip(item)"></label>
                        </span>
                        <span class="company">
                            {{item.trademark_name}}
                        </span>
                        <span class="type">
                            {{item.trademark_type}}
                        </span>
                        <span v-if="item.price" class="price">
                            {{item.price}}
                        </span>
                        <span v-else class="pricing" @click="openDialog(1,item)">
                            定价
                        </span>
                </div>
                <div style="height:200px">
                </div>
                </scroller>
        methods:{
            getData(){
                let form = this.formData
                registrantsGet(form).then((res)=>{
                    if(form.page == '1'){
                        this.list = res.data
                        this.list.forEach(item=>{
                            this.$set(item,"checked",false)
                        })
                        this.initScroll = true
                        this.$refs.scroller.finishInfinite()
                        if(this.list.length< 20){
                           this.emptyData = true
                            return 
                        }
                    }else{
                        this.$refs.scroller.finishInfinite()
                        let resArr = res.data
                        if(resArr.length == 0){
                            this.emptyData = true
                            return
                        }
                        resArr.forEach(item=>{
                            this.$set(item,"checked",false)
                        })
                        this.list = [...this.list,...resArr]
                    }
                    if(this.initRegistrants){
                        this.registrants = res.registrants
                        this.registrants.unshift({registrant_hash:'0',company_name:'全部申请人'})
                        this.initRegistrants = false
                    }
                })
            },
            // 初始化搜索字段
            initSearch(){
                this.initScroll = false
                this.emptyData = false
                this.formData.page = 1
                // this.list=[]
                this.$refs.scroller.scrollTo(0,0,true) //滚动到scrooler这个模块内容的顶部
            },
            // 接受popup组件 emit的申请人
            getApplicant(item){
                this.initSearch()
                this.formData.registrant_hash=item.registrant_hash
                this.getData()
            },
            // 接受popup组件 emit的商标类别
            getBrandType(item){
                this.initSearch()
                this.formData.trademark_type=item.id
                this.getData()
            },  
            // 接受Header组件搜索emit 的内容
            getSearchContent(val){
                this.initSearch()
                this.formData.keyword=val
                this.getData()
            },
            // 接受Header组件 点击编辑emit 的内容
            editHandle(bol){
                if(bol){
                   this.list.forEach((item)=>{
                       item.checked=true
                   })
                }else{
                      this.list.forEach((item)=>{
                       if(!item.price){
                           item.checked=false
                       }
                   })
                }
                this.showSetPrice= bol
            },
            // 调起设定价格弹框
            openDialog(id,item){
                this.dialogItem = item
                console.log(item,"item")
                this.dialogType = id
                this.hidMask = true
            },
            confirm(){
                if(this.dialogType == '1'){
                    this.dialogItem.price = this.inputPrice
                }else{
                    this.list.forEach(item=>{
                        if(item.checked){
                            item.price = this.inputPrice
                        }
                    })
                }
                this.inputPrice= ''
                this.hidMask = false
            },
            // 发布商标
            publish(){
                var publishList = this.list.filter(item=>{
                    return item.checked
                })
                // this.publishMask = true
                console.log(publishList)
                released(publishList).then((res)=>{
                    console.log(res,"res")
                })
            },
            infinite: function (done) {
                if(this.emptyData){ 
                    this.$refs.scroller.finishInfinite(true)
                    return;
                }
                if(!this.initScroll){
                    return
                }
                this.formData.page++;
                this.getData()
            },
            // 返回我的商标
            rebackMyBrand(){
    
            },
            // 查看发布商标
            watchPublishBrand(){
    
            },
            dialogTip(item){
                // 不在编辑模式下并且价格为空
                if(!item.price&&!this.showSetPrice){
                    this.toast = true
                    setTimeout(()=>{
                        this.toast = false
                    },1500)
                }
            }
        }
  • 相关阅读:
    POJ-2253 Frogger dijsktra查找间隔最小的路径
    LightOJ-1282 Leading and Trailing 模算数 快速幂 对数的用法
    LightOJ-1341 Aladdin and the Flying Carpet 分解质因数(注意对大素数的优化)
    UVA-10200 Prime Time 素数(注意除法精度)
    POJ-2142 The Balance 扩展欧几里德(+绝对值和最小化)
    ArchLinux 音乐播放客户端ncmpcpp和服务端mpd的配置
    [笔记-统计学习方法]感知机模型(perceptron) 原理与实现
    [Bug]Python3.x AttributeError: libtest.so: undefined symbol: fact
    [Bug]C++ XXX:undefined reference to "xxx"
    ip代理池的爬虫编写、验证和维护
  • 原文地址:https://www.cnblogs.com/MR-cui/p/10490980.html
Copyright © 2011-2022 走看看