Twitter bootstrap 如何在bootstrao vue表中显示git日志数据?

Twitter bootstrap 如何在bootstrao vue表中显示git日志数据?,twitter-bootstrap,vue.js,vue-component,Twitter Bootstrap,Vue.js,Vue Component,我有一个备份函数,可以获取git日志,过滤它们并将它们发送到前端API。前端按预期方式获取数据,我试图将其绑定到Vue.JS中的data属性之一。检索到的数据如下所示: [ { author: 'Yury Stanev', email: 'yury.stanev@menlolab.com', message: 'test', hash: '9807965a9b00f44fd7eb9611cead6445bb472eb9', date: '2019-08-28 12

我有一个备份函数,可以获取git日志,过滤它们并将它们发送到前端API。前端按预期方式获取数据,我试图将其绑定到
Vue.JS
中的
data
属性之一。检索到的数据如下所示:

[ { author: 'Yury Stanev',
    email: 'yury.stanev@menlolab.com',
    message: 'test',
    hash: '9807965a9b00f44fd7eb9611cead6445bb472eb9',
    date: '2019-08-28 12:13:28 -0400' },
  { author: 'Yury Stanev',
    email: 'yury.stanev@menlolab.com',
    message: 'added a file',
    hash: '704c86ef685d31a0de1589e5d3db16dd483bebc3',
    date: '2019-08-28 12:08:45 -0400' } ]
My Vue组件试图将其绑定到前面定义的
data().gitCommissions

<template>
  <div>
    <!-- <b-table
      striped
      hover
      :git-commits="gitCommits"
    />-->

    <!-- TODO: fix table issue -->
    <ul id>
      <li v-for="log in gitCommits">
        Author: {{ log.author }}
        <br>
        E-Mail: {{ log.email }}
        <br>
        Commit Message: {{ log.message }}
        <br>
        Hash: {{ log.hash }}
        <br>
        Date: {{ log.date }}
        <br>
        <br>
      </li>
    </ul>
  </div>
</template>

<script>
export default {
  name: 'GitLog',
  props: {},
  data() {
    return {
      err: false,
      gitCommits: [],
    };
  },

  created() {
    this.fetchCommits();
  },

  methods: {
    fetchCommits() {
      this.$socket.emit('project.gitLog', {
        owner: this.$route.params.owner,
        name: this.$route.params.name,
      }, (data) => {
        if (data.err) {
          console.error(data.err);
          return;
        }

        // console.log('DATA:\n', data);
        this.gitCommits = data.files;
        // console.log('gitCommits -> ', typeof (this.gitCommits), this.gitCommits);
        // console.log('Array -> ', Array.isArray(this.gitCommits));
        // console.log('gitCommins:\n', this.gitCommits);
      });
    },
  },
};
</script>

大学教师;t尝试将console.log中的gitCommits隐式转换为字符串。只需调用console.log('gitCommits',this.gitCommits);好的,没关系,我已经修好了。但我的主要问题是要在表中显示,我试图帮助您查看表中的内容。它是数组还是对象?执行typeof(this.gitCommits)表示它是对象。typeof([])也表示“对象”,因为JS数组也是对象。查看控制台输出console.log('gitCommits',this.gitCommits),您将看到它是数组还是对象。
const debug = require('debug')('SOCKET:project.gitLog');

const menlolabGitManage = require('@menlolab/git-manage-client');

// Middlewares
const hasProject = require('../../middlewares/has-project.socket'); // data.project = {info, package}

module.exports = ctx => async (data, ack) => {
  debug(ctx.userId, data);
  await ctx.sessionCheck();
  await hasProject(ctx, data);

  const gitLog = await menlolabGitManage.gitLog({
    owner: data.project.owner,
    repo: data.project.name,
  });

  console.log(gitLog);

  ack({ files: gitLog });
};