From 1094219a586e190006d3593ed94cde9117b1313f Mon Sep 17 00:00:00 2001 From: SimonGschnell Date: Wed, 18 Dec 2024 14:26:45 +0100 Subject: [PATCH] helper(Json.js):adds new helper component to display JSON data in the template, that can be used globally inside a vuejs app --- public/js/helpers/Json.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 public/js/helpers/Json.js diff --git a/public/js/helpers/Json.js b/public/js/helpers/Json.js new file mode 100644 index 000000000..31d51a52d --- /dev/null +++ b/public/js/helpers/Json.js @@ -0,0 +1,21 @@ +export default { + data(){ + return { + + } + }, + props:{ + data:{ + type:Object|String, + } + }, + computed:{ + componentData: function(){ + if(!this.data){ + return "Pass data to be printed by adding the :data prop on the component"; + } + return JSON.stringify(this.data, null, 2); + }, + }, + template:`
{{componentData}}
` +} \ No newline at end of file