编辑器优化--出现编译模板错误 [Vue Warn]: Error compiling template?

按照教程至 “加载和渲染”, 刷新页面,并没有正确显示Simditor编辑器。

  1. 查看public的css, js目录中引进生成了相关的css,js文件, 与教程一致。
  2. 右键查看 “新建话题” 源码

    .........
    <!-- 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 都可进入查看

  3. 浏览器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

《L03 构架 API 服务器》
你将学到如 RESTFul 设计风格、PostMan 的使用、OAuth 流程,JWT 概念及使用 和 API 开发相关的进阶知识。
《L02 从零构建论坛系统》
以构建论坛项目 LaraBBS 为线索,展开对 Laravel 框架的全面学习。应用程序架构思路贴近 Laravel 框架的设计哲学。
最佳答案

已经找到问题了,script脚本引入位置错误。
原写法:【app.blade.php】中

<body>
    <div id="app" class="{{ route_class() }}-page">
      .....
          <!-- Scripts -->
         <script src="{{ asset('js/app.js') }}"></script>
         @yield('scripts')
    </div>
</body>

**把scripit放到了div中了, 提取出来发到div外面 或直接放在

5年前 评论
讨论数量: 1

已经找到问题了,script脚本引入位置错误。
原写法:【app.blade.php】中

<body>
    <div id="app" class="{{ route_class() }}-page">
      .....
          <!-- Scripts -->
         <script src="{{ asset('js/app.js') }}"></script>
         @yield('scripts')
    </div>
</body>

**把scripit放到了div中了, 提取出来发到div外面 或直接放在

5年前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!