解决方案 »

  1.   

    context.attach('html', [
            {header: 'Compressed Menu'},
            {text: 'Back', href: '#'},
            {text: 'Reload', href: '#'},
            mycars[0],
            mycars[1],
            mycars[2],
            {text: 'View Page Source', href: '#'},
            {divider: true},
            {text: 'Inspect Element', href: '#'},
        ]);
    就可以啊
      

  2.   


    可以写个数组插入var mycars = new Array();
    mycars[0]={text: 'Print', href: '#'};
    mycars[1]={text: 'Print', href: '#'};
    mycars[2]={text: 'Print', href: '#'};var rmenu = [
    {header: 'Compressed Menu'},
    {text: 'Back', href: '#'},
    {text: 'Reload', href: '#'},
    ];
    // 循环插入mycars
    for(var i=0; i<mycars.length; i++){
    rmenu.push(mycars[i]);
    }rmenu.push(
    {text: 'View Page Source', href: '#'},
    {divider: true},
    {text: 'Inspect Element', href: '#'}
    );context.attach('html', rmenu);