K
K
Kagtaviy2017-03-02 19:31:31
go
Kagtaviy, 2017-03-02 19:31:31

How to use vuejs and golang?

Hello, there is a problem.
I'm using vuejs and golang, the problem is that
I can't display value from data

<div class="online">
                    Онлайн
                    <p>{{ onlineuser }}</p>
                </div>

vuejs
new Vue({
    el: '#main',
    data: {
        onlineuser: 0,
    },
  .....
})

{{ onlineuser }} - because of this, an error occurs and I don’t know what to do because outputting data to a template in go and vuejs is very similar:

Answer the question

In order to leave comments, you need to log in

2 answer(s)
U
uvelichitel, 2017-03-02
@Kagtaviy

You can change the delimiters {{.}} in Go template to any other https://golang.org/pkg/html/template/#Template.Delims
myTemplate.Delims("<<", ">>")

E
Evgeniy Ivakha, 2017-03-09
@ivahaev

Why use templates in Go only to use them in Vue.js? You can give files just static, without processing. Or, as already mentioned above, replace the separators in one of the template engines.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question