javascript - vue template syntax rules
怪我咯
怪我咯 2017-05-19 10:20:48
0
3
618

I just used vue, and I instinctively thought that in templates, strings or literals can only be passed in attributes by wrapping them in double quotes.

But the answer to this question tells me that it doesn’t seem to always be the case.

I’m not sure, in the template part of Vue, what identifies which part is html and which part is js? Just like jsx.

怪我咯
怪我咯

走同样的路,发现不同的人生

reply all(3)
phpcn_u1582

The value of a general instruction can be a js expression. Since it is a js expression, it satisfies the syntax of ES
v-bind="js expression"

某草草

Template is a component, and a component must have only one root node. The script tag is the JS part.

洪涛

Vue is composed of a component:
<template>

<p>
//html部分
</p>

</template>

<script>
export defalt{

//js部分
data(){
    return{}//数据源
},
methods:{
    //函数体部分,js的主要逻辑控制
}

}
</script>

<style>

//针对上述html的css样式

</style>

See the official API for details

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template