Skip to content

vue中使用lodash防抖函数 #30

@CodeDreamfy

Description

@CodeDreamfy

在将lodash集成进vue项目里面后,想使用里面的throttle/debounce方法,如下:

export default {
	methods: {
		debounce() {
			_.throttle(()=>{...code}, 200);
		}
	}
}

发现无论如何都不会被触发,后来查看了别人的用法,才发现原来是这样用的:

export default {
	methods: {
		debounce: _.throttle(()=>{...code}, 200)
	}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions