我只是想把searchRecord变量作为回调。
这是我的剧本:
chrome.tabs.executeScript(null, {
code: 'var script = document.createElement("script");\
script.type = "text/javascript";\
script.textContent = \
"var column = new nlobjSearchColumn(`name`);\
var searchRecord = nlapiSearchRecord(`subsidiary`, null, null, column);\
console.log(searchRecord)";\
document.head.appendChild(script);
script.textContent'
}, function (results) {
console.log(results)
})
脚本的结果是被评估的最后一个表达式,但它以字符串形式返回:
"var column = new nlobjSearchColumn(`name`); var searchRecord = nlapiSearchRecord(`subsidiary`, null, null, column); console.log(searchRecord)"
我很感激帮助!