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]
编程PDF电子书免费下载: http://www.shitanlife.com/code 每天学习一点点