Framework7 Uncaught SyntaxError: Unexpected token >
recently i been learning Phonegap with Framework7
I counter an issue that call "Uncaught SyntaxError: Unexpected token >".
By checking adb logcat, i notice that issue come with this code. This code is help me to do event handler while page was init. It was all working find at browser, but once build into android it shows the error.
//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);
});
});
By define at the top of function: it return this error , Uncaught SyntaxError: Unexpected token (", ... It shows at "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/8038.html
上一篇: 如何使用Servlets和Ajax?