diy-style-preview.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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" :other-page-data="otherPageData" @update="update" @updateother="updateOther"></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. otherPageData:{
  32. type: Object,
  33. default () {
  34. return {}
  35. }
  36. }
  37. },
  38. computed: {
  39. activeCompName() {
  40. return this.getName(this.activeItem)
  41. }
  42. },
  43. data() {
  44. return {};
  45. },
  46. methods: {
  47. getName(target) {
  48. try {
  49. return target ? target.funcListItem.type + "-style" : ""
  50. } catch (e) {
  51. console.log(e);
  52. return ""
  53. }
  54. },
  55. update(item) {
  56. this.$emit('update', item, this.activeIndex)
  57. },
  58. updateOther(item){
  59. this.$emit('updateother', item)
  60. },
  61. permisChange(arr) {
  62. this.activeItem.permission = arr
  63. this.$emit('update', this.activeItem)
  64. }
  65. }
  66. });
  67. </script>
  68. <style>
  69. .dsp-contain {
  70. position: relative;
  71. width: 467px;
  72. height: 100%;
  73. background: #FFFFFF;
  74. }
  75. </style>