Vue.js component for displaying arbitrary JavaScript values (supporting circular references)
See the live demo to try it out. (demo app on github)
The main purpose of this component is to display complex JavaScript values that may contain circular references. The component renders the value as a tree that can be manually expanded to display nested values.
The experience is very similar to inspecting JavaScript objects using the browser developer tools. The component was created to build the in-browser JavaScript debugger for the PARAPPLE project.
# Install the component
npm install --save vue-object-view
Use it just like any other Vue.js component. The value to display is passed as v-model
or :value
:
<VueObjectView v-model="object" />
<VueObjectView :value="anotherObject" />
Property | Meaning | Default |
---|---|---|
nowrap |
Prevent word wrap (display the unexpanded value on a single line) | true |
expandButtonText |
Content of the expand button | '...' |
If you wish to change the visual appearance of the component, set the following CSS classes in your application stylesheet:
vue-object-view
- Main component elementvue-object-view-primitive
- Element wrapping primitive valuesvue-object-view-complex
- Element wrapping Objects and Arraysvue-object-view-open
- The open button (chevron right/down)vue-object-view-expand
- The expand button (...)