fuxingloh / vue-horizontal

An ultra simple pure vue horizontal layout for modern responsive web with zero dependencies. (SPA/SSG/SSR)
https://vue-horizontal.fuxing.dev
MIT License
228 stars 32 forks source link

Refresh: optional callback #102

Open Venatum opened 3 years ago

Venatum commented 3 years ago

First of all, thank you for your great work !

Using the refresh function, I discovered that the callback was not optional. I think it's just an oversight of an if.

vue-horizontal.vue#L240

/**
 * Manually refresh vue-horizontal
 * @param callback after refreshed, optional
 */
refresh(callback: (data: VueHorizontalData) => void): void {
    this.$nextTick(() => {
        const data = this.calculate()
        this.left = data.left
        this.width = data.width
        this.scrollWidth = data.scrollWidth
        this.hasNext = data.hasNext
        this.hasPrev = data.hasPrev
        callback(data)
    })
},