svghmi/widget_back.ysl2
branchsvghmi
changeset 2958 895d3f2b1786
parent 2912 d320367eb2ad
child 3232 7bdb766c2a4d
equal deleted inserted replaced
2957:c0ea5015e46f 2958:895d3f2b1786
     1 // widget_back.ysl2
     1 // widget_back.ysl2
     2 
     2 
     3 template "widget[@type='Back']", mode="widget_defs" {
     3 template "widget[@type='Back']", mode="widget_class"
     4     param "hmi_element";
     4     ||
     5 
     5     class BackWidget extends Widget{
     6     |     on_click: function(evt) {
     6         on_click(evt) {
     7     |         if(jump_history.length > 1){
     7             if(jump_history.length > 1){
     8     |            jump_history.pop();
     8                jump_history.pop();
     9     |            let [page_name, index] = jump_history.pop();
     9                let [page_name, index] = jump_history.pop();
    10     |            switch_page(page_name, index);
    10                switch_page(page_name, index);
    11     |         }
    11             }
    12     |     },
    12         }
    13     |     init: function() {
    13         init() {
    14     |         this.element.setAttribute("onclick", "hmi_widgets['«$hmi_element/@id»'].on_click(evt)");
    14             this.element.setAttribute("onclick", "hmi_widgets['"+this.element_id+"'].on_click(evt)");
    15     |     },
    15         }
    16 }
    16     }
    17 
    17     ||