对不起我的英语不好.这是示例代码:
/**
* @constructor
*/
function MyNewClass(){
this.$my_new_button = $('<button>Button</button>');
this.my_value = 5;
this.init = function (){
$('body').append(this.$my_new_button);
this.$my_new_button.click(
function (){
// Its always alerts "undefined"
alert(this.my_value);
}
)
}
}
Run Code Online (Sandbox Code Playgroud)
如何my_value在jQuery click事件函数中访问对象属性?可能吗?
我有一个基于 debian 的 Docker 容器(主机在 Windows 10 上)。它通过apt-get install -y --no-install-recommends chromium. 当我运行测试命令时:
/usr/bin/chromium --headless --disable-gpu --no-sandbox --hide-scrollbars --window-size="1920,1080" --default-background-color=00000000 --hide-scrollbars --disable-features=NetworkService --virtual-time-budget=20000 --screenshot=/tmp/screenshot.png https://www.google.com
Run Code Online (Sandbox Code Playgroud)
它抱怨说:
[0916/202547.786718:ERROR:gpu_channel_manager.cc(398)] ContextResult::kFatalFailure: Failed to create shared context for virtualization.
Run Code Online (Sandbox Code Playgroud)
尽管有错误,我还是得到了正确的屏幕截图,但无论如何我都想摆脱这个警报。谷歌搜索没有帮助。