i am create a new project in framework7 using framework7-cli, cordova and www selected, webpack selected, and so on…
after project directory generated, in app.js located in /src/js/app.js, i am trying to test JSON.parse method when app init. so my complete app.js looks like this :
import $$ from ‘dom7’;
import Framework7 from ‘framework7/framework7.esm.bundle.js’;// Import F7 Styles
import ‘framework7/css/framework7.bundle.css’;// Import Icons and App Custom Styles
import ‘…/css/icons.css’;
import ‘…/css/app.css’;
// Import Cordova APIs
import cordovaApp from ‘./cordova-app.js’;
// Import Routes
import routes from ‘./routes.js’;// Import main app component
import App from ‘…/app.f7.html’;var app = new Framework7({
root: ‘#app’, // App root element
component: App, // App main component
id: ‘id.co.dnastudio.dompu.bersinar’, // App bundle ID
name: ‘Dompu Bersinar’, // App name
theme: ‘auto’, // Automatic theme detection// App routes
routes: routes,// Input settings
input: {
scrollIntoViewOnFocus: Framework7.device.cordova && !Framework7.device.electron,
scrollIntoViewCentered: Framework7.device.cordova && !Framework7.device.electron,
},
// Cordova Statusbar settings
statusbar: {
iosOverlaysWebView: true,
androidOverlaysWebView: false,
},
on: {
init: function () {
var f7 = this;
if (f7.device.cordova) {
// Init cordova APIs (see cordova-app.js)
cordovaApp.init(f7);
}//my script var stringJson = '{link : "sas", linkName : "mkmkm"}' var messageJson = JSON.parse(stringJson); console.log("link"+ messageJson.link); console.log("linkName"+ messageJson.linkName); },
},
});
see my new script bellow the //my script comment.
then i run my apps using npm run start. in console log,
Uncaught (in promise) Error: SyntaxError: Unexpected token l in JSON at position 1
what i am missing in my project??