zoukankan      html  css  js  c++  java
  • 组件传值

     1  <div id='lazyload' class='vux-1px-tb' @click='loadMoreData' v-show='islazyshow'>  //在这个子组件里面loadMoreData自定义事件用于把信息传到父组件
     2       <span>{{loadText}}</span>                                     // islazyShow是父组件的数据变化传到子组件
     3     </div>
     4   </div>
     5 </template>                    
    6 <script> 7 import dateutil from '@/util/date'; 8 export default { 9 data() { 10 return { 11 12 } 13 }, 14 props: { 15 getCorpList: Array, 16 loadBtnText: String, 17 islazyshow:Boolean//组件内利用props传值 18 }, 19 created() { 20 console.log('coprlistgroup', this.$route.path) 21 }, 22 computed: { 23 corpList() { 24 return JSON.parse(JSON.stringify(this.getCorpList)) 子组件中 25 },
    1  <kp-corp-group :getCorpList="corpList" :loadBtnText="setLoadText" :islazyshow="islazyshow" @corpDetail="getCorpDetail" @loadMore="loadMoreData" ></kp-corp-group>
     data () {
        return {
          islazyshow:false,//然后你可以用了(父组件的文件中)
          isLoadMore: true,
          corpList: []
        }
    
    
    
     callback: res => {
                console.log('获取企业列表成功')
                this.$store.commit('mergeAllCorpList', {
                  items: res.data
                })
                this.loading = false
                this.corpList = this.corpList.concat(res.data)
                if (this.corpList.length < 10) {
                  this.islazyshow = false
                } else if(this.corpList.length >= 10 && this.corpList.length != res.total){
                  this.islazyshow = true
                   this.setLoadText = '点击加载更多数据' 
                } else if(this.corpList.length === res.total){
                  this.islazyshow = true
                  this.isLoadMore = false
                  this.setLoadText = '暂无更多数据'
                } 
                this.chooseSource = this.chooseStatus = false
              }
            }
            corpList(request)
          }
        },

    年轻的时候无论你去那家公司记得一件事,成长比对错重要。

    https://www.cnblogs.com/ygtq-island/p/6864477.html    初学者看这个传值

  • 相关阅读:
    StratifiedKFold和KFold的区别(几种常见的交叉验证)
    剑指offer:用栈来建立队列
    剑指offer:斐波那契数列
    树状数组 gcd 查询 Different GCD Subarray Query
    Loadrunner的使用
    Loadrunner的使用
    MySQL Windows 环境安装
    RobotFrameWork 自动化环境搭建(基于 python3.6)
    MySQL Linux 环境安装
    【读书笔记】状态模式代码C#
  • 原文地址:https://www.cnblogs.com/lujunan/p/10302708.html
Copyright © 2011-2022 走看看