Solve the code loads slow, so garbled ----- VUE

vue.js solve start code is loaded, so garbled

vue.js can solve this problem by a few lines of code

css:

[v-cloak] {
            display: none;
        }

html:

<div id="app" v-cloak></div>

Once vue will use to load and then finished rendering, it will not appear in the code view.

Passing on a few basic vue api.

Binding css style:

css:

.done {
            text-decoration: line-through;
            color: #ccc;
        }

html:

<span v-bind:class="{done:item.done}">
    {{item.title}}</span>

v-bind: class = "{done style: This is the style: This item is some of the screening, item.done those selected to true}"

Click event:

v-on: click = "Here write events"

@ Click = "" and the same as above

const app = new Vue({
                el: '#app',
                data: {
                    todos,
                    todoText: ''
                },
                methods: {
                    handleAddTodoClick() {
                        xxxxx
                    }
}

Bind button:

<input type="text" value="" v-model='todoText' @keydown.enter="handleAddTodoClick" />

This is a binding Enter.

Followed by the opportunity to write something else.

Guess you like

Origin www.cnblogs.com/cth0/p/11564737.html