Advertisement
Guest User

Untitled

a guest
Oct 15th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. export default function (count = 10) {
  2. // @vue/component
  3. return {
  4. data () {
  5. return {
  6. displayPriority: 0,
  7. }
  8. },
  9.  
  10. mounted () {
  11. this.runDisplayPriority()
  12. },
  13.  
  14. methods: {
  15. runDisplayPriority () {
  16. const step = () => {
  17. requestAnimationFrame(() => {
  18. this.displayPriority++
  19. if (this.displayPriority < count) {
  20. step()
  21. }
  22. })
  23. }
  24. step()
  25. },
  26.  
  27. defer (priority) {
  28. return this.displayPriority >= priority
  29. },
  30. },
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement