github.com/v2pro/plz@v0.0.0-20221028024117-e5f9aec5b631/witch/webroot/viz-value.html (about)

     1  <script type="text/x-template" id="viz-value-template">
     2      <component :is="view()" @showPtr="showPtr" @hidePtr="hidePtr"
     3                 :data="data" :path="path">
     4      </component>
     5  </script>
     6  <script>
     7      Vue.component('viz-value', {
     8          template: '#viz-value-template',
     9          props: ['data', 'path'],
    10          methods: {
    11              view: function () {
    12                  if (Array.isArray(this.data)) {
    13                      return 'viz-array'
    14                  }
    15                  if ((typeof this.data) === 'object') {
    16                      if (this.data.__ptr__) {
    17                          return 'viz-ptr'
    18                      }
    19                      return 'viz-struct'
    20                  }
    21                  return 'viz-plain';
    22              },
    23              showPtr: function (e) {
    24                  this.$emit('showPtr', e);
    25              },
    26              hidePtr: function (e) {
    27                  this.$emit('hidePtr', e);
    28              }
    29          }
    30      });
    31  </script>