Không hiển thị khi tiki:for tin tức trên IOS

{{item.title}} {{item.date}} em đã làm như vậy khi hiển thị tin tức nhưng trên IOS thì không hiển thị gì còn trên android thì ngon lành

em có dùng cả thẻ recycle-view nhưng vẫn vậy không vuốt đc

@Ha_Huy_C_ng em cho anh xem thử code txml, js và tcss chỗ đó nha

1 Like
type or paste code here
<view class="form-group">
  <scroll-view scroll-y="{{true}}" style="height: 100vh;" onScrollToUpper="upper" onScrollToLower="lower">
    <banners class="home-banners" isLoading="{{isLoading}}" banners="{{banners}}" />
    <view tiki:for="{{news_datas}}">
      <view class="item-tintuc" onTap="onTap" data-tintuc="{{item}}" data-index="{{index}}">
        <image class="image-tintuc" src="{{news_datas[index].image}}" />
        <view class="title-news">
          <text class="text-title-news" number-of-lines="3" space="nbsp">{{news_datas[index].title}}</text>
          <text class="date-news">{{news_datas[index].date}}</text>
        </view>
      </view>
    </view>
  </scroll-view>
</view>
.item-tintuc {
  margin: 6px;
  height: 12vh;
  background: #fff;
  display: flex;
  align-items: center;
  border-radius: 5px;
  box-shadow: 3px 3px 5px  rgba(23, 22, 24, 0.438) ;
}

.image-tintuc {
  width: 35vw;
  height: 11vh;
  border-radius: 10px;
  text-align: center;
}

.home-banners {
  width: 100vw;
}

.title-news {
  max-width: 65vw;
  padding-left: 10px;
}

.text-title-news {
  text-align: left;
  font-weight: 500;
  font-size: 2vh;
}

.date-news {
  text-align: left;
  font-weight: 500;
  font-size: 2vh;
}

.form-group {
  flex: 1
}

.form-group1 {
  height: 100vh;
  width: 100vw;
  background-color: rgb(29, 45, 194);
}

Page({
  data: {
    isLoading: true,
    loadPages: false,
    banners: [],
    news_datas: [],
    page_number: 1,
    scrollTop: 0,
  },

  lower() {
    this.data.page_number = this.data.page_number + 1;
    this.data.loadPages = true;
    this.getData(false);
    console.log("lower");
  },

  scrollToTop(e) {
    console.log(e);
    this.setData({
      scrollTop: 0,
    });
  },

  onLoad() {
    this.data.loadPages = true;
    this.getData(true);
  },

  onShow(){
    console.log("call api fail:");
    my.switchTab({ url: `pages/Authentication/login/index` });
  },

  getData(fresh) {
    if (fresh) {
      if (this.data.loadPages) {
        my.request({
          url: `https://api.kungfustockspro.live:8443/api/guest/news/get-list-news-from-category?type=cafef
            &category=T%E1%BA%A5t%20c%E1%BA%A3&page=${this.data.page_number}&item_per_page=14`,
          success: (res) => {
            let random = Math.floor(Math.random() * (res.length - 3));
            this.setData({
              news_datas: res,
              banners: res.slice(random, random + 3),
              isLoading: false,
            });
          },
          fail: (err) => {
            console.log("call api fail:", err);
          },
        });
      }
    } else {
      if (this.data.loadPages) {
        my.request({
          url: `https://api.kungfustockspro.live:8443/api/guest/news/get-list-news-from-category?type=cafef
          &category=T%E1%BA%A5t%20c%E1%BA%A3&page=${this.data.page_number}&item_per_page=14`,
          success: (res) => {
            this.setData({
              news_datas: this.data.news_datas.concat(res),
              isLoading: false,
            });
          },
          fail: (err) => {
            console.log("call api fail:", err);
          },
        });
      }
    }
  },

  onTap(event) {
    console.log(event);
    const id = event.target.dataset.tintuc.id;
    const title = event.target.dataset.tintuc.title;
    const thumbnail_url = event.target.dataset.tintuc.image;

    my.navigateTo({
      url: `pages/tin-tuc/chitiet-tintuc/index?tintuc_id=${id}&title=${title}&thumbnail_url=${thumbnail_url}`,
    });
  },
});

e xin gửi 3 file a xem hộ e với ạ

Page({
  data: {
    isLoading: true,
    loadPages: false,
    banners: [],
    news_datas: [],
    page_number: 1,
    scrollTop: 0,
  },

  lower() {
    this.data.page_number = this.data.page_number + 1;
    this.data.loadPages = true;
    this.getData(false);
    console.log("lower");
  },

  scrollToTop(e) {
    console.log(e);
    this.setData({
      scrollTop: 0,
    });
  },

  onLoad() {
    this.data.loadPages = true;
    this.getData(true);
  },

  onShow(){
    console.log("call api fail:");
    my.switchTab({ url: `pages/Authentication/login/index` });
  },

  getData(fresh) {
    if (fresh) {
      if (this.data.loadPages) {
        my.request({
          url: `https://api.kungfustockspro.live:8443/api/guest/news/get-list-news-from-category?type=cafef
            &category=T%E1%BA%A5t%20c%E1%BA%A3&page=${this.data.page_number}&item_per_page=14`,
          success: (res) => {
            let random = Math.floor(Math.random() * (res.length - 3));
            this.setData({
              news_datas: res,
              banners: res.slice(random, random + 3),
              isLoading: false,
            });
          },
          fail: (err) => {
            console.log("call api fail:", err);
          },
        });
      }
    } else {
      if (this.data.loadPages) {
        my.request({
          url: `https://api.kungfustockspro.live:8443/api/guest/news/get-list-news-from-category?type=cafef
          &category=T%E1%BA%A5t%20c%E1%BA%A3&page=${this.data.page_number}&item_per_page=14`,
          success: (res) => {
            this.setData({
              news_datas: this.data.news_datas.concat(res),
              isLoading: false,
            });
          },
          fail: (err) => {
            console.log("call api fail:", err);
          },
        });
      }
    }
  },

  onTap(event) {
    console.log(event);
    const id = event.target.dataset.tintuc.id;
    const title = event.target.dataset.tintuc.title;
    const thumbnail_url = event.target.dataset.tintuc.image;

    my.navigateTo({
      url: `pages/tin-tuc/chitiet-tintuc/index?tintuc_id=${id}&title=${title}&thumbnail_url=${thumbnail_url}`,
    });
  },
});