array

" to define an array."/> array

" to define an array.">

Home >Web Front-end >Vue.js >How to represent arrays in vue.js

How to represent arrays in vue.js

藏色散人
藏色散人Original
2021-01-14 09:29:485091browse

Arrays in vue.js are represented by single square brackets. The method of creating an array is: first create a code sample file; then pass the statement "f251896cc55feb04911e1d9bd4f7d248Array94b3e26ee717c64999d7867364b1b4a3" to define an array.

How to represent arrays in vue.js

The operating environment of this tutorial: windows7 system, vue version 2.0, DELL G3 computer.

[Recommended related articles: vue.js]

Representation methods of strings, objects, and arrays in Vue.js

1. String It is double curly brackets {{ }}

2. The object is single curly brackets { }

3. The array is single square brackets [ ]

<div id="app">
    <!--字符串-->
    <p :class="a">{{str}}</p>
    <!--对象-->
    <p :class="{aClass:isA,bClass:isB}">对象</p>
    <!--数组-->
   <p :class="[&#39;aClass&#39;,&#39;bClass&#39;]">数组</p>
</div>
<script type="text/javascript" src="../js/vue.js"></script>
<script type="text/javascript">
  const vm=new Vue({
    el: &#39;#app&#39;,
    data: {
      a: &#39;aClass&#39;,
      str: &#39;字符串&#39;,
      isA: true,
      isB: false
    },
  })
</script>

The above is the detailed content of How to represent arrays in vue.js. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:what is vueNext article:what is vue