Javascript 节点红色UI模板如何清除缓存
嗨,我有一个像这样的UI模板节点Javascript 节点红色UI模板如何清除缓存,javascript,html,node.js,node-red,Javascript,Html,Node.js,Node Red,嗨,我有一个像这样的UI模板节点 [{"id":"a5c1aeec.acf41","type":"ui_template","z":"317f5671.321bea","group":"7390bf6e.e7d18","name":"alert","order":0,"width":"","height":"","format":"<meta http-equiv=\"cache-control\" content=\"no-cache\" />\n<meta http-equ
[{"id":"a5c1aeec.acf41","type":"ui_template","z":"317f5671.321bea","group":"7390bf6e.e7d18","name":"alert","order":0,"width":"","height":"","format":"<meta http-equiv=\"cache-control\" content=\"no-cache\" />\n<meta http-equiv=\"Pragma\" content=\"no-cache\" />\n<meta http-equiv=\"Expires\" content=\"-1\" />\n\n<div></div>\n<script>\n\n(function(scope) {\n scope.$watch('msg', function(msg) {\n alert(msg.payload);\n return msg;\n });\n \n})(scope);\n \n</script>\n\n","storeOutMessages":false,"fwdInMessages":false,"templateScope":"local","x":930,"y":540,"wires":[[]]},{"id":"ea160087.f05fd","type":"inject","z":"317f5671.321bea","name":"","topic":"","payload":"hello","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":704,"y":539,"wires":[["a5c1aeec.acf41"]]},{"id":"7390bf6e.e7d18","type":"ui_group","z":"","name":"info","tab":"3b15c8d0.06c048","order":5,"disp":false,"width":"9","collapse":false},{"id":"3b15c8d0.06c048","type":"ui_tab","z":"","name":"config","icon":"settings","order":4}]
[{“id”:“a5c1aeec.acf41”,“type”:“ui_template”,“z”:“317f5671.321bea”,“group”:“7390bf6e.e7d18”,“name”:“alert”,“order”:0,“width”:“height”:“format”:“\n\n\n\n\n\n\n\n(函数(作用域){\n作用域.$watch,“storeOutMessages”:false,“fwdInMessages”:false,“templateScope”:“local”,“x”:930,“y”:540,“wires”:[[]]},{“id”:“ea160087.f05fd”,“type”:“inject”,“z”:“317f5671.321bea”,“name”:“topic”:“payloadType”:“hello”,“payloadType”:“str”,“repeat”:“crontab”:“once”:“一次”:false”,“OnPlay”:0.1”,“x”:704,“y”:539,“wires”:[“a5c1aeec.acf41”],{“id”:“73906BFE.e7d18”},”“:”ui_group“,”z“,”name“:”info“,”tab“:”3b15c8d0.06c048“,”order“,”disp“:”false“,”width“:”9“,”collapse“:false},{”id“:”3b15c8d0.06c048“,”type“:”ui_tab“,”z“,”name“:”配置“,”图标“:”设置“,”order“:”4}]
当我重新加载页面时,虽然没有“msg.payload”传递给它,但这是使用以前的值执行的。
有谁能帮我清除缓存或重新加载时,这应该不会显示任何警报。如果没有这样设置,您可以检查变量并跳过警报:
(function(scope) {
scope.$watch('msg', function(msg) {
if(typeof(window.lastAlert)=="undefined"){
window.lastAlert = msg;
}else{
alert(msg.payload);
}
return msg;
});
这在我使用chrome时起了作用。更新流后,可能必须清除浏览器缓存。(chrome中的Ctrl+F5)
[{“id”:“14e8dc7a.390aa4”,“type”:“ui_模板”,“z”:“98c20df4.95abc”,“group”:“d1f187ec.103688”,“name”:“alert”,“order”:0,“width”:“height”:“format”:“\n\n\n\n\n(函数(作用域){\n作用域.$watch('msg',函数(msg){\n if(typeof(window lastAlert)=“未定义”){\n window.lastAlert=msg;\n}else{\n alert(msg.payload);\n}\n}\n}(scope);\n\n\n\n“storeOutMessages”:false,“fwdInMessages”:false,“templateScope”:“local”,“x”:690,“y”:360,“wires”:[]},{“id”:“c59c7cc4.0593e”,“type”:“inject”,“z”:“98c20df4.95abc”“名称”:“主题”:“有效载荷”:“你好”,“有效载荷类型”:“str”,“repeat”:“crontab”:“once”:false,“onceDelay”:0.1,“x”:510,“y”:360,“电线”:[[“14e8dc7a.390aa4”]]],{“id”:“d1f187ec.103688”,“type”:“ui_组”,“z”:“name”:“info”,“tab”:“aa1700c2.78e64”,“order”:5,“disp”:false,“width”:“9”,“collapse”:false},{“id”:“aa1700c2.78e64”,“type”;“ui”;“tab”;“ui”,“名称”:“配置”,“图标”:“设置”,“顺序”:4}]
很抱歉,它不工作。正常警报也不显示。您使用的浏览器/操作系统是什么?我使用的是chrome和windows 7,我已通过将标志存储在本地存储中解决了此问题。即,在一个模板中设置本地存储,在发出警报之前,我检查该标志是否为真,然后仅显示警报。
[{"id":"14e8dc7a.390aa4","type":"ui_template","z":"98c20df4.95abc","group":"d1f187ec.103688","name":"alert","order":0,"width":"","height":"","format":"<meta http-equiv=\"cache-control\" content=\"no-cache\" />\n<meta http-equiv=\"Pragma\" content=\"no-cache\" />\n<meta http-equiv=\"Expires\" content=\"-1\" />\n\n<div></div>\n<script>\n\n(function(scope) {\n scope.$watch('msg', function(msg) {\n if(typeof(window.lastAlert)==\"undefined\"){\n window.lastAlert = msg;\n }else{\n alert(msg.payload);\n }\n return msg;\n });\n})(scope);\n\n</script>\n\n","storeOutMessages":false,"fwdInMessages":false,"templateScope":"local","x":690,"y":360,"wires":[[]]},{"id":"c59c7cc4.0593e","type":"inject","z":"98c20df4.95abc","name":"","topic":"","payload":"hello","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":510,"y":360,"wires":[["14e8dc7a.390aa4"]]},{"id":"d1f187ec.103688","type":"ui_group","z":"","name":"info","tab":"aa1700c2.78e64","order":5,"disp":false,"width":"9","collapse":false},{"id":"aa1700c2.78e64","type":"ui_tab","z":"","name":"config","icon":"settings","order":4}]