Framework7未捕获的SyntaxError:意外的令牌>

最近我一直在用Framework7学习Phonegap

我反击一个调用“Uncaught SyntaxError:Unexpected token>”的问题。

通过检查adb logcat,我注意到这个代码附带的问题。 这段代码可以帮助我在页面初始化时执行事件处理程序。 这一切都在浏览器中找到,但一旦构建到android它显示错误。

//Framework 7 on Page Init and load eventhandler
app.on('pageInit', (page) => {

    console.log(page);

    // -----------------------------------
    $$('#popqrbtn').on('click', function (){
    app.preloader.show();
    $$('#qrcodeCanvas').empty();
    $$('#qr_close').hide();

    var rand = Math.floor(Math.random() * 1000)+300;
    console.log(rand);

    setTimeout(function () {
      jQuery('#qrcodeCanvas').qrcode({
          width: 300,
          height: 300,
          text    : "https://www.facebook.com",
      });   
      app.preloader.hide();   
      $$('#qr_close').show();
    }, rand);  
    });

});

通过在函数顶部定义:它返回此错误,未捕获的SyntaxError:意外的标记(“,...它显示在”on:“

// Dom7
var $$ = Dom7;

// Framework7 App main instance
var app  = new Framework7({
  root: '#app', // App root element
  id: 'io.framework7.testapp', // App bundle ID
  name: 'Framework7', // App name
  theme: 'auto', // Automatic theme detection
  // App root data
  data: function () {
    return {
      user: {
        firstName: 'John',
        lastName: 'Doe',
      },
      // Demo products for Catalog section
      products: [
        {
          id: '1',
          title: 'Apple iPhone 8',
          description: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nisi tempora similique reiciendis, error nesciunt vero, blanditiis pariatur dolor, minima sed sapiente rerum, dolorem corrupti hic modi praesentium unde saepe perspiciatis.'
        },
        {
          id: '2',
          title: 'Apple iPhone 8 Plus',
          description: 'Velit odit autem modi saepe ratione totam minus, aperiam, labore quia provident temporibus quasi est ut aliquid blanditiis beatae suscipit odio vel! Nostrum porro sunt sint eveniet maiores, dolorem itaque!'
        },
        {
          id: '3',
          title: 'Apple iPhone X',
          description: 'Expedita sequi perferendis quod illum pariatur aliquam, alias laboriosam! Vero blanditiis placeat, mollitia necessitatibus reprehenderit. Labore dolores amet quos, accusamus earum asperiores officiis assumenda optio architecto quia neque, quae eum.'
        },
      ]
    };
  },
  // App root methods
  methods: {
    helloWorld: function () {
      app.dialog.alert('Hello World!');
    },
  },
  // App routes
  routes: routes,
  on:{
    pageInit(page){

      console.log(page);
      // -----------------------------------
      $$('#popqrbtn').on('click', function (){
      app.preloader.show();
      $$('#qrcodeCanvas').empty();
      $$('#qr_close').hide();

      var rand = Math.floor(Math.random() * 1000)+300;
      console.log(rand);

      setTimeout(function () {
        jQuery('#qrcodeCanvas').qrcode({
            width: 300,
            height: 300,
            text    : "https://www.facebook.com",
        });   
        app.preloader.hide();   
        $$('#qr_close').show();
      }, rand);  
      });
    }
  }
});
链接地址: http://www.djcxy.com/p/8037.html

上一篇: Framework7 Uncaught SyntaxError: Unexpected token >

下一篇: Uncaught syntaxerror unexpected token }