Добавление пользовательского js выдает ошибку vue, что делает мой пользовательский js не компилируемым - PullRequest
0 голосов
/ 30 мая 2019

Я пытаюсь добавить пользовательский код JS, который бы отображал динамические поля повторителя, но всякий раз, когда я загружаю страницу, она выдает ошибку.

Это мой файл edit.blade.php, в который я добавил скрипт

@extends('layouts.app')
@prepend('scripts')
  <script src="/js/Repeater.js"></script>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script>
  @endprepend
   ........

Я получаю ошибку:

[Vue warn]: Error compiling template:

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.

480|      </div>
481|  </div>
482|  
   |   
483|  <script>
   |  ^^^^^^^^
484|  jQuery.fn.extend({
   |  ^^^^^^^^^^^^^^^^^^
485|      createRepeater: function (options = {}) {
   |  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
486|          var hasOption = function (optionKey) {
   |  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
487|              return options.hasOwnProperty(optionKey);
   |  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
488|          };
   |  ^^^^^^^^^^
489|          var option = function (optionKey) {
   |  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
490|              return options[optionKey];
   |  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
491|          };
   |  ^^^^^^^^^^
492|          var addItem = function (items, key, fresh = true) {
   |  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
493|              var itemContent = items;
   |  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
494|              var group = itemContent.data("group");
...............................
^^^^^^

(found in <Root>)

Что я здесь не так делаю?

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...