V
V
Vanik Khachatryan2018-05-10 21:50:45
JavaScript
Vanik Khachatryan, 2018-05-10 21:50:45

Why is there a huge error in the console, although the script is running?

There is a so-called main layout and scripts are connected at the end of it

{{ javascript_include('js/vue.js')}}
    {{ javascript_include('js/scripts.js')}}

(This is Volt, so don’t pay attention to the connection syntax)
the first one is obviously the view itself, and the second one is my scripts for all pages
var app = new Vue({
    el: '#app',
    delimiters: ['${', '}'],
    data: {
        message: 'Привет, Vue!'
    }
});

It looks like this, but in the future of course there will be a bunch of functions, etc.
So, the script runs fine and displays ${message}, but the error in the console is:
[Vue warn]: Error compiling template:
....
....
            </div>
        </div>
    </div>
    <script type="text/javascript" src="/public/js/vendor.js"></script>
    <script type="text/javascript" src="/public/js/bundle.js"></script>
        
    <script type="text/javascript" src="/public/js/vue.js"></script>
    <script type="text/javascript" src="/public/js/scripts.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.
- 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.


(found in <Root>)

I don't understand what it means and how to solve it.
PS Are there any other methods of organizing the frontend on vue, but at the same time that all the data would be received from the server not with the help of Ajax at the first entry, but immediately there was a rendered page?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
E
Evgeny Kulakov, 2018-05-10
@VaniXac

In the warning, it seems to be clearly written that you should not use the script tag in the template so that it will not be steamed to avoid unwanted effects.

X
xxvxx, 2021-01-23
@xxvxx

You probably didn't close the Div

S
Stalker_RED, 2018-05-10
@Stalker_RED

I don't understand what it means and how to solve it.
Translate error text for you?
immediately there was a rendered page
ssr

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question