蟒:import jsonposts = [{'author':'JL Rowling','title':'Harry Potter'},{'author':'JRR Tolkien','title':'Lord of the Rings'},]encoded_posts = json.dumps(posts)javascript:let obj = {{ encoded_posts }};控制台中记录了 JS 错误:Uncaught SyntaxError: Unexpected token ';'这是根据控制台的页面。它似乎正在失去(?)的.{{encoded_posts}}<!DOCTYPE html><html> <head> <title>Flask Blog - About</title> </head> <body> <h1>About page!</h1> <script> let text = document.getElementsByTagName('h1')[0]; text.addEventListener('click',function(){ text.style.color = 'red'; }); let obj = ; let jsonPosts = JSON.parse(); console.log(jsonPosts); </script> </body></html>发生了什么事情?
添加回答
举报
0/150
提交
取消