47 lines
935 B
JavaScript
47 lines
935 B
JavaScript
// import i18n from '@/i18n'
|
|
|
|
export default {
|
|
name: 'StatusComponent',
|
|
props: {
|
|
injectData: {
|
|
type: Object,
|
|
default: () => ({})
|
|
}
|
|
},
|
|
data() {
|
|
return {
|
|
statusText: [
|
|
'正常',
|
|
'异常',
|
|
'损坏',
|
|
// more...
|
|
],
|
|
statusType: [
|
|
'success',
|
|
'warning',
|
|
'danger',
|
|
// more...
|
|
]
|
|
}
|
|
},
|
|
computed: {
|
|
isEnabled() {
|
|
return this.injectData && (this.injectData.enabled === 1 || this.injectData.enabled.toString() === '1')
|
|
}
|
|
},
|
|
mounted() {
|
|
console.log('[component] StatusComponent: ', this.injectData)
|
|
},
|
|
methods: {
|
|
// 发射事件
|
|
emit(opt) { }
|
|
},
|
|
render: function (h) {
|
|
return h('el-tag',
|
|
{
|
|
props:
|
|
{ size: 'small', type: this.isEnabled ? this.statusType[0] : this.statusType[1] }
|
|
},
|
|
this.isEnabled ? this.statusText[0] : this.statusText[1])
|
|
}
|
|
} |