2017-10-13 75 views
1

框架7訪問https://framework7.io/docs/action-sheet.html框架7操作表不起作用

操作表打開但不能在其他頁面上工作來此頁面。我認爲不會在頁面視圖初始化

這是我的js代碼

$$('.demo-actions').on('click', function() { 
var buttons = [ 
    { 
     text: 'Short By:', 
     label: true 
    }, 
    { 
     text: 'XYZ', 
     bold:true, 
    }, 
    { 
     text: 'ABC', 
     bold:true, 

    }, 
    { 
     text: '123', 
     bold:true, 
    }, 
    { 
     text: 'abc', 
     color: 'red' 
    }, 
]; 
myApp.actions(buttons); 

});

這是HTML代碼

<a href="#" class="demo-actions buttons ">XYZ</a> 

回答

1

這裏的解決方案:

$$(document).on('pageInit', function(e) { 
 
    refreshCalls(); 
 
}); 
 
refreshCalls(); 
 

 
function refreshCalls() { 
 
    /* ===== Action sheet, we use it on dashboard pages ===== */ 
 
    $$('.demo-actions').on('click', function() { 
 
     var buttons = [{ 
 
      text: 'Short By:', 
 
      label: true 
 
     }, { 
 
      text: 'XYZ', 
 
      bold: true, 
 
     }, { 
 
      text: 'ABC', 
 
      bold: true, 
 

 
     }, { 
 
      text: '123', 
 
      bold: true, 
 
     }, { 
 
      text: 'abc', 
 
      color: 'red' 
 
     }, ]; 
 
     myApp.actions(buttons); 
 
    }); 
 
}