0๐
This is happening because your client app (vue.js) is expecting to receive some valid JSON object, but your server is giving a HTML page.
When attempting to convert some string like <html><head>...
into a javascript object, your JSON parser fails and gives that error. To replicate this locally, open your developer console and run the following command:
JSON.parse("<html></html>")
To find out what exactly is going wrong, you need to look into the network tab of developer console and look at the server responses for API requests โ you expect JSON but server might be serving index.html
Assuming your server side is all good and handles API requests as expected, then it might be a simple error in your vue component โ instead of loading your tag data from /api/tag/1
(which gets a valid JSON string), you might be attempting to load /tag/1
(which will only get your index.html
).
- [Vuejs]-What does `args.unshift(this)` do in Vue's use.js?
- [Vuejs]-Object data overide all previous data