vue中once实现函数只执行一次
vue源码中once函数实现传入的函数只执行一次,
function once(fn) { let called = false return function () { if (!called) { called = true fn.apply(this, arguments) } } }
vue源码中once函数实现传入的函数只执行一次,
function once(fn) { let called = false return function () { if (!called) { called = true fn.apply(this, arguments) } } }