import { getCurrentInstance } from 'vue'

const collectStack = []
export const openCollect = () => {
    collectStack.push([])
    return () => collectStack.pop()
}

export const quiltCollect = item => {
    if (collectStack.length) {
        collectStack[collectStack.length - 1].push(item)
    }
}

export const quiltCollectVM = () => quiltCollect(getCurrentInstance())
