vue.js mixins 使用

export default {
  data () {
    return {
    }
  },
  created () {
  },
  methods: {
    arrayContain (array, obj) {
      for (var i = 0; i < array.length; i++) {
        if (array[i] === obj) {
          return true
        }
      }
      return false
    },
    getGradeName: function (gradeId) {
      let gradeName = ''
      if (gradeId === '7') {
        gradeName = '七年级'
      } else if (gradeId === '8') {
        gradeName = '八年级'
      } else if (gradeId === '9') {
        gradeName = '九年级'
      } else if (gradeId === '10') {
        gradeName = '高一'
      } else if (gradeId === '11') {
        gradeName = '高二'
      } else if (gradeId === '12') {
        gradeName = '高三'
      } else if (gradeId === '21') {
        gradeName = 'Grade 1'
      } else if (gradeId === '22') {
        gradeName = 'Grade 2'
      } else if (gradeId === '23') {
        gradeName = 'Grade 3'
      }
      return gradeName
    }
  }
}

  

 

import common from '@mixins/common.js'



mixins: [common, login]

  

posted @ 2019-07-09 15:23  漫步CODE人生  阅读(1023)  评论(0编辑  收藏  举报