preview.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <template id="operation-center-preview">
  2. <div class="diy-operation-center">
  3. <div>当前选择:</div>
  4. <div>切换</div>
  5. </div>
  6. </template>
  7. <script>
  8. /**
  9. * @descriptions
  10. * 1. 组件名字必须对应模板形式 - 递归组件name
  11. * 2. 样式内容方法尽量内部维护 - 前端方便通用
  12. * 3. 父级组件会传预览数据 - activeItem
  13. */
  14. Vue.component('operation-center-preview', {
  15. name: "operation-center-preview",
  16. props: {
  17. activeItem: {
  18. type: Object,
  19. default () {
  20. return {}
  21. }
  22. }
  23. },
  24. template: '#operation-center-preview',
  25. computed: {
  26. computedStyle() {
  27. return this.activeItem.computedStyle
  28. },
  29. searchData() {
  30. return this.activeItem.data
  31. }
  32. },
  33. });
  34. </script>
  35. <style>
  36. .diy-operation-center{
  37. padding:12px 24px;
  38. display: flex;
  39. justify-content: space-between;
  40. }
  41. </style>