<template>
  <van-list
    v-model="loadShow"
    :offset="50"
    :immediate-check="false"
    :finished="finished"
    :finished-text="finished_text"
    @load="onLoad"
  >
    <slot />
  </van-list>
</template>

<script>
export default {
  name: "WlLoadMore",
  props: {
    value: {
      type: Boolean,
      default: false,
    },
    finished: {
      type: Boolean,
      default: false,
    },
    finished_text: {
      type: String,
      default: "没有更多了"
    }
  },
  data() {
    return {
      loadShow: false,
    };
  },
  methods: {
    onLoad() {
      this.$emit("load");
    },
  },
  watch: {
    value: {
      handler(val) {
        this.loadShow = val;
      },
      immediate: true,
    },
    loadShow(val) {
      this.$emit("input", val);
    },
  },
};
</script>

<style lang="scss" scoped></style>
