Vue用[]括号打印我的数组,为什么?

时间:2019-03-12 14:16:09

标签: javascript arrays vue.js

我想打印出数组中的值,而不是dd = {'a': [100,150,180,190], 'year': [2010, 2011, 2010,2011], 'class': [1,2, 1,2]} df2 = pd.DataFrame(data=dd) Out[92]: a year class 0 100 2010 1 1 150 2011 2 2 180 2010 1 3 190 2011 2 。它应该为数组中的每个索引创建一个['value']框。

div='col-md'

HTML模板:

const app = new Vue({
    el: "#app", 
    data() {
        return {
            step: 1,
            ansPurchaseonly: [
                ['Leasehold', 'Freehold'],
                ['Leasehold', 'Freehold']

            ],

相反,在html呈现的页面中,我得到了类似[“ Leasehold”,“ Freehold”的输出。我只想: 租赁 永久产权

1 个答案:

答案 0 :(得分:1)

您可以使用另一个v-for,因为您的“ opt”仍然是一个数组,或者您可以使用join值,例如

<div class="row white-boxes justify-content-center">
  <div class="col-md-3 col-sm-12 h-100 d-table" 
       v-for="(opt, index) in ansPurchaseonly">
          <span>{{ opt.join(' ') }}</span>
  </div>
</div>