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    初学者看这个传值

  • 相关阅读:
    Redis安装(源码安装)
    为 Blade 模板引擎添加新文件扩展名
    使用国内镜像composer安装laravel
    从github上下载项目到eclipse
    js中使用Java的方式
    File类中的list()和listFiles()方法
    与文件上传到的三个类:FileItem类、ServletFileUpload 类、DiskFileItemFactory类
    DiskFileItemFactory类
    如何获取.properties配置文件
    Linux、Windows中的相对路径和绝对路径
  • 原文地址:https://www.cnblogs.com/lujunan/p/10302708.html
Copyright © 2011-2022 走看看