包装器应该只调用委托,转发传递给包装器的参数。
鉴于
$(document).on("click", "#hwTab1, #hwTab2, #hwTab3, #hwTab4, #hwTab5, #hwTab6",
function (evt) { // add the event parameter here
$("#hwTab1Tab, #hwTab2Tab, #hwTab3Tab, #hwTab4Tab, #hwTab5Tab, #hwTab6Tab").hide();
var linkIDtmp = $(evt.target).attr('id'); // use evt.target instead of this
var linkTmp = "#" + linkIDtmp + "Tab";
$(linkTmp).show();
var divTmp = '#' + linkIDtmp + 'Content';
var tabName = linkIDtmp[0].charAt(0).toUpperCase() + linkIDtmp[0].substr(1,mode.length)
$.get('/api/sitecore/HwTabsWrapper/HwTabsWrapperCtrl?Tab=' + tabName +
'&pv=/Views/Components/_HwTabsWrapperCtrl.cshtml',
function (data) {
$(divTmp).html(data);
})
});
何时 delegate.ps1内容:
.\wrapper.ps1 1 2
然后期望输出为:
param($one, $two)
write-host "one=$one and two=$two"
wrapper.ps1内容:
one=1 and two=2
如果我尝试以下wrapper.ps1的实现:
.\delegate # How do I forward all args passed to this wrapper script to the delegate script?
输出错误:
.\delegate $args
答案 0 :(得分:5)
答案 1 :(得分:2)
PowerShell提供了一个ProxyCommand
类,旨在简化这一过程。要为命令生成包装函数的文本,例如MyCommand
,您可以执行
$wrapper = [System.Management.Automation.ProxyCommand]::Create((get-command MyCommand))