The basic syntax summary vue (a)

Look at the two kinds of code, and then explain

The first format:

<template >
  <div>
    <div v-for=" item in sites ">
      <li>{{item.name}}</li>
      <li>---------</li>
    </div>
  </div>
</template>
<script>
export default {
  name: "v-if",
  data() {
    return {
      sites: [{ name: "goolge" }, { name: "baidu" }, { name: "cnlinfo" }]
    };
  }
};
</script>

 The second format:

<div id="app">
          <li>{{mesg}}</li>
          <li>---------</li>
        </div>
    <script>
        var vm=new Vue({
            el:"#app",
            data:"跟我学vue"
        })
    </script>

We can see the syntax There are many ways in which the Internet is based tutorial second, the first of it, you need to install and configure can. For details, refer me to the first article.
Let's talk about the basic syntax of the key inside: 

 

Keyword use
new view ({}) For instantiation, learned c # and other languages ​​will be more clearly
el parameters ID DOM elements
data Attribute is used to define, or a value
methods Named Incredibles is the function or c # methods, collectively referred to here my method, after all, used to do back-end, I do not want changed to a
return Return data or termination of the logic operation
{{}} Object properties or methods used to output the value returned by
export default {} Set up in the usual way, it will be set up in the Detailed

Today on the first write so, are the basis for comparison of content, it is inevitable wrong place is also normal, after all, is to carry out the program, not a scholarship to the practical application based.
For programming learning is concerned, there are no shortcuts can go only constant practice, from the most simple exercises, learn, discover and solve problems, do not care about the kind of language is the best language.
It does not matter, I think so, it is important how you use it freely!

Guess you like

Origin www.cnblogs.com/c546170667/p/11285872.html