diy-style-preview.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <template id="diy-style-preview">
  2. <el-scrollbar class="dsp-contain">
  3. <diy-header :active-item="activeItem" @permis-change="permisChange" :all-permission="permission">
  4. <components :is="activeCompName" :active-item="activeItem" @update="update"></components>
  5. </diy-header>
  6. </el-scrollbar>
  7. </template>
  8. <script>
  9. Vue.component('diy-style-preview', {
  10. name: "diy-style-preview",
  11. template: '#diy-style-preview',
  12. props: {
  13. activeItem: {
  14. type: Object,
  15. default () {
  16. return {}
  17. }
  18. },
  19. activeIndex: {
  20. type: Number,
  21. default () {
  22. return 0
  23. }
  24. },
  25. permission: {
  26. type: Array,
  27. default () {
  28. return []
  29. }
  30. },
  31. },
  32. computed: {
  33. activeCompName() {
  34. return this.getName(this.activeItem)
  35. }
  36. },
  37. data() {
  38. return {};
  39. },
  40. methods: {
  41. getName(target) {
  42. try {
  43. return target ? target.funcListItem.type + "-style" : ""
  44. } catch (e) {
  45. console.log(e);
  46. return ""
  47. }
  48. },
  49. update(item) {
  50. this.$emit('update', item, this.activeIndex)
  51. },
  52. permisChange(arr) {
  53. this.activeItem.permission = arr
  54. this.$emit('update', this.activeItem)
  55. }
  56. }
  57. });
  58. </script>
  59. <style>
  60. .dsp-contain {
  61. position: relative;
  62. width: 467px;
  63. height: 100%;
  64. background: #FFFFFF;
  65. }
  66. </style>