Skip to content

Commit

Permalink
Merge pull request #165 from Jenesius/issue_162
Browse files Browse the repository at this point in the history
update readme example.
  • Loading branch information
Jenesius authored Aug 23, 2023
2 parents fe8778d + ba58bcc commit 0769ce1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions examples/simple-form/App.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div class="container">
<div>
<pre class="container-values">{{ JSON.stringify(values, undefined, 4) }}</pre>
<div class = "container-values">
<pre style = "margin: 0"><code v-html = "prettyPrint.call(values)"></code></pre>
</div>

<div class="wrap-app">
Expand Down Expand Up @@ -59,6 +59,26 @@ const programLanguageOptions = {
py: 'Python'
}
function prettyPrint(this: object){
var jsonLine = /^( *)("[\w]+": )?("[^"]*"|[\w.+-]*)?([,[{])?$/mg;
var replacer = function(match, pIndent, pKey, pVal, pEnd) {
var key = '<span class="json-key" style="color: brown">',
val = '<span class="json-value" style="color: navy">',
str = '<span class="json-string" style="color: olive">',
r = pIndent || '';
if (pKey)
r = r + key + pKey.replace(/[": ]/g, '') + '</span>: ';
if (pVal)
r = r + (pVal[0] == '"' ? str : val) + pVal + '</span>';
return r + (pEnd || '');
};
return JSON.stringify(this, null, 3)
.replace(/&/g, '&amp;').replace(/\\"/g, '&quot;')
.replace(/</g, '&lt;').replace(/>/g, '&gt;')
.replace(jsonLine, replacer);
}
</script>

<style>
Expand Down
Binary file modified readme-example.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 0769ce1

Please sign in to comment.