<commit_before><template>
  <div class="home">
    <div class="wrapper">
      <div class="main" v-for="item in items" :key="item._id">
        <div class="page-title">
          <router-link :to="{ name: 'articlesWithTag', params: { tag: tag }}" v-for="tag in item.tags">
            <span class="tag">{{ tag }}</span>
          </router-link>
          <!-- <span class="tag" v-for="tag in item.tags">{{ tag }}</span> -->
          <span class="time">创建于 {{ frontFormatDate(item.createTime) }}</span>
        </div>
        <h1 class='title'>{{ item.title }}</h1>
        <div class="list-main">
          <div id="wrapper" v-html="marked(item.content)"></div>
          <div class="shadow">
            <router-link :to="{ name: 'fullArticle', params: { id: item._id }}">
              <span class="read-btn">阅读全文</span>
            </router-link>
          </div>
        </div>
      </div>
  </div>
</template>

<script>
import axios from 'axios'
import marked from 'marked'
import hljs from 'highlight.js'
import Store from '../../store.js'
require('highlight.js/styles/atom-one-dark.css')
require('../../css/markdown.css')

marked.setOptions({
  highlight: function (code, lang, callback) {
    return hljs.highlightAuto(code).value
  }
})

export default {
  name: 'Home',

  created () {
    if (this.$route.name === 'index') {
      this.getAllArticles()
    } else {
      this.getArticlesByTag()
    }
  },

  data () {
    return {
      items: []
    }
  },

  methods: {
    getAllArticles () {
      axios.get(`${Store.BASE_URL}/getArticles`).then(response => {
        this.items = response.data
      })
    },

    getArticlesByTag () {
      axios.get(`${Store.BASE_URL}/getArticlesByTag`, {
        params: {
          tag: this.$route.params.tag
        }
      }).then(response => {
        this.items = response.data
      })<commit_msg>splice items length<commit_after><template>
  <div class="home">
    <div class="wrapper">
      <div class="main" v-for="item in items" :key="item._id">
        <div class="page-title">
          <router-link :to="{ name: 'articlesWithTag', params: { tag: tag }}" v-for="tag in item.tags">
            <span class="tag">{{ tag }}</span>
          </router-link>
          <!-- <span class="tag" v-for="tag in item.tags">{{ tag }}</span> -->
          <span class="time">创建于 {{ frontFormatDate(item.createTime) }}</span>
        </div>
        <h1 class='title'>{{ item.title }}</h1>
        <div class="list-main">
          <div id="wrapper" v-html="marked(item.content)"></div>
          <div class="shadow">
            <router-link :to="{ name: 'fullArticle', params: { id: item._id }}">
              <span class="read-btn">阅读全文</span>
            </router-link>
          </div>
        </div>
      </div>
  </div>
</template>

<script>
import axios from 'axios'
import marked from 'marked'
import hljs from 'highlight.js'
import Store from '../../store.js'
require('highlight.js/styles/atom-one-dark.css')
require('../../css/markdown.css')

marked.setOptions({
  highlight: function (code, lang, callback) {
    return hljs.highlightAuto(code).value
  }
})

export default {
  name: 'Home',

  created () {
    if (this.$route.name === 'index') {
      this.getAllArticles()
    } else {
      this.getArticlesByTag()
    }
  },

  data () {
    return {
      items: []
    }
  },

  methods: {
    getAllArticles () {
      axios.get(`${Store.BASE_URL}/getArticles`).then(response => {
        this.items = response.data.splice(0, 5)
      })
    },

    getArticlesByTag () {
      axios.get(`${Store.BASE_URL}/getArticlesByTag`, {
        params: {
          tag: this.$route.params.tag
        }
      }).then(response => {
        this.items = response.data
      })
{'fraction_non_alphanumeric': 0.19182473951375903, 'fraction_numerical': 0.0016029922522041143, 'mean_word_length': 2.2698689956331877, 'pattern_counts': {'":': 0, '<': 65, '<?xml version=': 0, '>': 69, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4486563', 'n_tokens_mistral': 1259, 'n_tokens_neox': 1235, 'n_words': 243}