框架7行动表不起作用

时间:2017-10-13 03:24:57

标签: javascript html html-framework-7

framwork 7访问https://framework7.io/docs/action-sheet.html

操作表已打开但未在其他页面上工作。我认为不能在页面视图中初始化

这是我的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 个答案:

答案 0 :(得分:3)

此处的解决方案:

$$(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);
    });
}