New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
执行一段JavaScript脚本如何获取返回值的问题 #303
Comments
貌似用self.outputParameters["'执行JavaScript"]可以取到'执行JavaScript的返回值,还有其他方式么? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
执行一段JavaScript脚本如果要获取返回值,需要用return开头,但是有时候js代码会很多,直接用return开头可能有时候没有办法实现,特别是中间有声明和使用变量的时候,这个时候看提示会使用是否将执行后的输出/返回值作为字段记录:选择否(任可在任意操作中用F["操作名"]表示此命令返回值,这个用不明白,我现在的需求是执行一段js,我想把这段js的输出或者返回值保存成字段,这个能实现么?
比如我在某个页面执行一段js
const ogImages = [];
const metaTags = document.querySelectorAll('meta[name="og:image"]');
metaTags.forEach(tag => {
ogImages.push(tag.getAttribute('content'));
});
const ogImagesString = ogImages.join('\n');
console.log(ogImagesString);
return ogImagesString;
我想把返回的ogImagesString这个值保存成字段,这个能实现么?
The text was updated successfully, but these errors were encountered: