首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >节点红界面模板如何清除缓存

节点红界面模板如何清除缓存
EN

Stack Overflow用户
提问于 2018-08-21 15:15:27
回答 1查看 706关注 0票数 0

您好,我有一个UI模板节点,如下所示

代码语言:javascript
复制
[{"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}]

当我重新加载页面时,虽然没有传递"msg.payload“给它,但它是使用以前的值执行的。谁可以帮助我如何清除缓存或重新加载这应该不会显示任何警报。

EN

回答 1

Stack Overflow用户

发布于 2018-08-23 04:35:33

您可以检查变量并跳过警报,如果不是这样设置的话:

代码语言:javascript
复制
(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 )

代码语言:javascript
复制
[{"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}]
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51943454

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档