parent.js 594 B

123456789101112131415161718192021222324252627282930313233
  1. import { getParent, isEmpty } from '../utils'
  2. export default {
  3. data() {
  4. return {
  5. Parent: null,
  6. }
  7. },
  8. computed: {
  9. parent() {
  10. return this.getParent() || this.Parent || {};
  11. },
  12. hasParent() {
  13. return !isEmpty(this.parent)
  14. }
  15. },
  16. mounted() {
  17. this.Parent = this.getParent()
  18. },
  19. methods: {
  20. getParent() {
  21. if (!this.ComponentName) {
  22. return null
  23. }
  24. return getParent.call(this, this.ComponentName, this.Keys)
  25. }
  26. }
  27. }