const Router = {
get: (path, ...rest) => {
console.log(rest)
}
}
import router from '../shared/router';
router.get('/tester/123', someMiddleware, 'HomeController#index');
该函数显示f(path)
没有其余参数?
如果我将其更改为..
const Router = {
get: (path, second) => {
console.log(rest)
}
}
第二个会出现。。
f(path, second)
就像休息参数被删除一样。为什么是这样?