import cacheMixin from '@/components/Cache/mx-cache-mixin.js'

export default {
	mixins: [cacheMixin],
	data() {
		return {
			classTypeList: [],
      classTypeListReady: false
		}
	},
	beforeMount() {
		this.loadClassTypeList()
	},
	methods: {
		async loadClassTypeList() {
			this.classTypeList = await this.getClassTypeListByCache()
      this.classTypeListReady = true
			this.translateClassTypeReady()
		},
		translateClassTypeReady() {
			//to be overrided for non-computed needs
		},
		translateClassTypeName(type) {
			if (!type) return ''
			return this.classTypeList
				.find(t => t.value == type)?.label || '未知类型'
		},
	}
}
