### 更改為單個數據,原組件是左右
> 根目錄下找到該組件進行更改
* 在中間加入自己定義的all
```
<template>
<view class="u-waterfall">
<view id="u-left-column" class="u-column"><slot name="left" :leftList="leftList"></slot></view>
<view id="u-right-column" class="u-column"><slot name="right" :rightList="rightList"></slot></view>
<view id="u-all-column" class="u-column u-all"><slot name="all" :allList="allList"></slot></view>
</view>
</template>
```
* splitData下更改即可
```
async splitData() {
if (!this.tempList.length) return;
let leftRect = await this.$uGetRect('#u-left-column');
let rightRect = await this.$uGetRect('#u-right-column');
let allRect = await this.$uGetRect('#u-all-column');
if(!item) return ;
this.allList.push(item);
},
```
* clear也要加
```
// 清空數據列表
clear() {
this.leftList = [];
this.rightList = [];
this.allList = []
// 同時清除父組件列表中的數據
this.$emit('input', []);
this.tempList = [];
},
```
* 樣式
```
.u-all{
flex: unset !important;
width: 100%;
}
```
> 使用
```vue
<template>
<view>
<u-waterfall v-model="activeList" ref="uWaterfall">
<template v-slot:all="{allList}">
<view class="learnList">
<view class="item" v-for="(item,index) in allList" :key="index" @click="info(item)">
<text>{{item.noticeTitle}}</text>
</view>
</view>
</template>
</u-waterfall>
<u-loadmore bg-color="#fff" :status="loadStatus" @loadmore="getActiveList()"></u-loadmore>
</view>
</template>
<script>
export default {
data() {
return {
active: 0,
activeList: [],
loadStatus: 'loadmore',
// 分頁
page: {
num: 0,
limit: 10
},
moreStatus: true, // 個人求職,加載更多
};
},
onLoad() {
this.getActiveList()
},
onReachBottom() {
// 個人求職
if (this.moreStatus == true) {
this.loadStatus = 'loading';
// 模擬數據加載
setTimeout(() => {
this.getActiveList();
this.loadStatus = 'loadmore';
}, 1000)
}
},
methods: {
select(index) {
this.active = index;
this.page.num = 0;
this.$refs.uWaterfall.clear();
this.moreStatus = true
this.loadStatus = 'loadmore';
this.getActiveList()
},
getActiveList() {
this.page.num++;
this.$u.get("/system/notice/list", {
noticeType: this.tabCate[this.active].id,
pageNum: this.page.num,
pageSize: this.page.limit
}).then(res => {
if (res.code == 200) {
let resData = res.rows
this.activeList = this.activeList.concat(resData)
if (resData.length == 0 || res.total <= this.activeList.length) {
this.moreStatus = false
this.loadStatus = 'nomore';
}
}
})
},
}
}
</script>
<style lang="scss">
</style>
```
- 前端指南
- 基礎
- HTML、HTTP、web綜合問題
- css部分
- 學習指南
- 開發指南
- css指南
- JavaScript
- 視圖、文件
- canvas
- 二維碼的生成
- 64碼及圖片
- weui
- Promise
- 第三方js
- 網絡請求
- 字符串,數組,時間
- 時間類
- Css
- 布局封裝
- 媒體布局
- 九宮格圖片自適應
- 兩行顯示,且省略
- uni-app
- uniapp踩坑指南
- 表單類
- 商品規格
- 頁面操作
- H5端返回按鈕不顯示
- H5解決瀏覽器跨域問題
- uView——Waterfall 瀑布流
- uniapp中使用復制功能(復制文本到粘貼板)
- 動態導航欄的實現
- React
- React基礎
- 微信小程序
- 上傳多圖
- uni-app 微信小程序生成小程序碼二維碼帶參數
- 小程序分享圖片給好友,到朋友圈,保存到本地
- 緩存封裝
- Vue
- 深度作用選擇器deep
- 使用js實現列表無限循環滾動(橫向)
- js 無限循環垂直滾動列表
- 可視化
- AntV
- 玫瑰圖