vueBus.js
697 Bytes
import Bus from 'vue';
let install = function (Vue) {
Vue.prototype.$bus = new Bus()
Vue.prototype.codeToName = function(array,tag){
let arrCopy = null
if(array.length <= 0 || array.length==null){
throw Error(`${array} length is null`)
}
if(tag == null || typeof(tag) == "undefined"){
return arrCopy
}
array.find(function (item, next) {
if(!!item.name){
if(tag == item.name){
arrCopy = item.title
return item.title
}
}else{
if(tag == item.value){
arrCopy = item.label
return item.label
}
}
});
return arrCopy
}
}
export default { install };