primevue-mirror/components/lib/basecomponent/BaseComponent.vue

27 lines
756 B
Vue
Raw Normal View History

2023-03-21 12:05:24 +00:00
<script>
import { ObjectUtils } from 'primevue/utils';
export default {
name: 'BaseComponent',
2023-03-21 12:05:24 +00:00
props: {
pt: {
type: Object,
value: {}
}
},
methods: {
2023-04-03 00:12:25 +00:00
getPTItem(obj = {}, key = '') {
const fKey = ObjectUtils.convertToFlatCase(key);
return obj[Object.keys(obj).find((k) => ObjectUtils.convertToFlatCase(k) === fKey) || ''];
},
2023-03-21 12:05:24 +00:00
ptm(key = '', params = {}) {
2023-04-03 00:12:25 +00:00
return ObjectUtils.getItemValue(this.getPTItem(this.pt, key), { props: this.$props, state: this.$data, ...params });
},
ptmo(obj = {}, key = '', params = {}) {
2023-04-03 00:12:25 +00:00
return ObjectUtils.getItemValue(this.getPTItem(obj, key), params);
2023-03-21 12:05:24 +00:00
}
}
};
</script>