The problem of using vue extends to inherit components containing solt

now the requirement is: I have a component scroll that looks something like this

<template>
  <div ref="wrapper" class="wrapper">
    <slot></slot>
  </div>
</template>
<script type="text/ecmascript-6">
import BScroll from "better-scroll"
export default {
  data () {
    return {
    }
  },
  mounted () {
    this.$nextTick(() => {
      this._initScroll()
    })
  },
  methods: {
    _initScroll () {
      if (!this.$refs.wrapper) {
        return
      }
      this.scroll = new BScroll(this.$refs.wrapper, {
        pullUpLoad: {
          threshold: 20
        }
      })
    }
  }
}

now I want to implement a scrollList component, inherit the scroll component and expand some functions, such as pull refresh, pull up and load.

<template>
  <div>
  </div>
</template>
<script type="text/ecmascript-6">
import Scroll from "@/components/scroll/Scroll"
export default {
  extends: Scroll,
  props: {},
  data () {
    return {
    }
  },
  mounted () {
  },
  methods: {
    pullingUp () {
    }
  },
  computed: {},
  components: {
  },
  watch: {}
}
</script>
<style scoped lang="scss">
</style>

when I used the scroll component before, I could insert data directly into solt,

<scroll>
    <div>xxxxxxxxx</div>
</scroll>

but using scrollList to write directly will not show. How should I deal with this situation?

Mar.07,2022

Hello, how was this finally solved? I also encountered the same problem

.
Menu