美文网首页
Weex踩坑实录

Weex踩坑实录

作者: LevyLin | 来源:发表于2018-05-11 10:27 被阅读0次

    1.新组件<recycle-list>无法与<loading>配合使用。目前遇到的情况主要是loading没法正常隐藏。

        <recycle-list class="gb-box" for="item in results">
            <cell-slot >
              <image class="i-gd" :src="item.url" resize="cover"/>
            </cell-slot>
            <loading class="loading" :display="loadinging?'show':'hide'" @loading="onloadMore">
              <text class="indicator-text">Loading ...</text>
              <loading-indicator class="indicator"></loading-indicator>
            </loading>
        </recycle-list>
    

    方法如下:

    methods: {
        loadData(index) {
          modal.toast({
            message: "loadData..." + index,
            duration: 2.0
          });
          stream.fetch(
            {
              method: "GET",
              type: "json",
              url: "http://gank.io/api/data/福利/10/" + index
            },
            res => {
              let data = res.data;
              this.loadinging = false;
              if (!data["error"]) {
                this.results.push(...data["results"]);
              }
            }
          );
        },
        onloadMore() {
          this.index++;
          this.loadinging = true;
          this.loadData(this.index);
        }
      }
    

    在加载成功后,居然就是不隐藏<loading>,后来改成<list>就正常了
    如下:

        <list class="gb-box">
            <cell v-for="item in results">
              <image class="i-gd" :src="item.url" resize="cover"/>
            </cell>
            <loading class="loading" :display="loadinging?'show':'hide'" @loading="onloadMore">
              <text class="indicator-text">Loading ...</text>
              <loading-indicator class="indicator"></loading-indicator>
            </loading>
        </list>
    

    相关文章

      网友评论

          本文标题:Weex踩坑实录

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