12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- import {
- getHeight
- } from "../../utils/GetRheRemainingHeight";
- Component({
- properties: {
- height: {
- type: Number
- }, //组件高度
- getlist: {
- type: Function
- },
- pullDown: { //是否开启下拉
- type: Boolean,
- value: true
- },
- safety: { //适配苹果底部安全距离
- type: Boolean,
- value: true
- },
- scrollX: {
- type: Boolean,
- value: false
- },
- direction: {
- type: Array,
- value: ["bottom"]
- }
- },
- data: {
- inRefresh: false, //下拉开启自定义项
- },
- methods: {
- /* 下拉刷新 */
- pullToRefresh() {
- this.setData({
- inRefresh: true
- })
- this.triggerEvent("getlist", true)
- },
- /* 刷新完成 */
- RefreshToComplete() {
- setTimeout(() => {
- this.setData({
- inRefresh: false
- })
- }, 500)
- },
- /* 加载分页 */
- loadThePage(e) {
- if (this.data.direction.includes(e.detail.direction)) this.triggerEvent("getlist", false)
- },
- /* 设置组件高度 */
- setHeight(element, that) {
- getHeight(element, that).then(res => {
- if (this.data.height != res) this.setData({
- height: res
- })
- });
- }
- }
- })
|