Properties.vue 1013 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <template>
  2. <div class="lb-properties">
  3. <code-mirror :value="text" :options="cmOptions" view-height="1000px" :is-scroll="true" />
  4. </div>
  5. </template>
  6. <script>
  7. export default {
  8. name: 'LbProperties',
  9. props: {
  10. data: {
  11. type: Object,
  12. required: true,
  13. },
  14. },
  15. data () {
  16. let text = this.data.metadata['sys:properties'] || ''
  17. try {
  18. text = JSON.stringify(JSON.parse(text), null, 4)
  19. } catch (e) {
  20. console.debug('parse sys:properties', e)
  21. }
  22. return {
  23. text: text,
  24. cmOptions: {
  25. tabSize: 2,
  26. styleActiveLine: true,
  27. lineNumbers: true,
  28. lineWrapping: true,
  29. line: true,
  30. name: 'javascript',
  31. json: true,
  32. theme: 'material',
  33. },
  34. }
  35. },
  36. }
  37. </script>
  38. <style lang="less" scoped>
  39. .lb-properties {
  40. ::v-deep .CodeMirror {
  41. border: 1px solid #eee;
  42. height: 100%;
  43. }
  44. ::v-deep .CodeMirror-scroll {
  45. max-height: 1000px;
  46. overflow-y: scroll;
  47. overflow-x: auto;
  48. }
  49. }
  50. </style>