编辑器优化--出现编译模板错误 [Vue Warn]: Error compiling template?
按照教程至 “加载和渲染”, 刷新页面,并没有正确显示Simditor编辑器。
- 查看public的css, js目录中引进生成了相关的css,js文件, 与教程一致。
-
右键查看 “新建话题” 源码
......... <!-- Styles --> <link rel="stylesheet" href="http://larabbs.test/css/app.css"> <link rel="stylesheet" type="text/css" href="http://larabbs.test/css/simditor.css"> </head> ........... <!-- Scripts --> <script src="http://larabbs.test/js/app.js"></script> <script type="text/javascript" src="http://larabbs.test/js/module.js"></script> <script type="text/javascript" src="http://larabbs.test/js/hotkeys.js"></script> <script type="text/javascript" src="http://larabbs.test/js/uploader.js"></script> <script type="text/javascript" src="http://larabbs.test/js/simditor.js"></script> <script type="text/javascript"> $(document).ready(function(){ var editor = new Simditor({ textarea: $('#editor'), }); }); </script> </div> <link rel='stylesheet' type='text/css' property='stylesheet' .......... ......
看上去似乎没有什么问题,直接点击响应的css, js 都可进入查看
-
浏览器F12查看,结果出现:
app.js:32438 [Vue warn]: Error compiling template: <div id="app" class="topics-create-page"> ........ </footer> <!-- Scripts --> <script src="http://larabbs.test/js/app.js"></script></div> Templates should only be responsible for mapping the state to the UI. Avoid placing tags with side-effects in your templates, such as <script>, as they will not be parsed.
Templates should only be responsible for mapping the state to the UI. Avoid placing tags with side-effects in your templates, such as script, as they will not be parsed.
上面的 "........" 为省略代码,只保留关键代码。
为了消除模板标签副作用,script标签不会被解析??? 这是为什么了??
Simditor版本与教程不一致,使用的是2.3.13
推荐文章: