vm.js 372 B

123456789101112131415
  1. import { getCurrentInstance } from 'vue'
  2. const collectStack = []
  3. export const openCollect = () => {
  4. collectStack.push([])
  5. return () => collectStack.pop()
  6. }
  7. export const quiltCollect = item => {
  8. if (collectStack.length) {
  9. collectStack[collectStack.length - 1].push(item)
  10. }
  11. }
  12. export const quiltCollectVM = () => quiltCollect(getCurrentInstance())