Skip to content

Commit aa0de9f

Browse files
authored
Merge pull request #7 from leezng/dev
release 1.3.5
2 parents 271c356 + d5ffef3 commit aa0de9f

File tree

10 files changed

+2811
-1968
lines changed

10 files changed

+2811
-1968
lines changed

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ cache:
77
- "node_modules"
88

99
install:
10-
- npm install
10+
- npm i
11+
- npm install vue@2
1112

1213
stages:
1314
- lint

example/App.vue

Lines changed: 37 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<div class="block">
1010
<h3>JSON Tree:</h3>
1111
<vue-json-pretty
12+
:deep="deep"
1213
:data="json"
1314
:path="'res'">
1415
</vue-json-pretty>
@@ -21,6 +22,19 @@
2122
<h3>JSON Input:</h3>
2223
<textarea v-model="val"></textarea>
2324

25+
<h3>Options</h3>
26+
<div class="options">
27+
<label>selectable-type</label>
28+
<select v-model="selectableType">
29+
<option>-</option>
30+
<option>both</option>
31+
<option>checkbox</option>
32+
<option>tree</option>
33+
</select>
34+
<label>path</label>
35+
<input type="text" v-model="path">
36+
</div>
37+
2438
<h3>Latest Click Result:</h3>
2539
<div>path: {{itemPath}}</div>
2640
<div>data: <pre>{{itemData}}</pre></div>
@@ -29,10 +43,10 @@
2943
<h3>JSON Tree:</h3>
3044
<vue-json-pretty
3145
:data="json"
32-
:path="'res'"
46+
:path="path"
3347
:path-checked="['res', 'res.c']"
34-
:path-selectable="pathSelectableFn"
35-
:selectable-type="'both'"
48+
:path-selectable="((path, data) => typeof data !== 'number')"
49+
:selectable-type="selectableType"
3650
@click="handleClick">
3751
</vue-json-pretty>
3852
</div>
@@ -69,6 +83,9 @@ export default {
6983
source: 'AI Finance'
7084
}]
7185
},
86+
selectableType: 'both',
87+
path: 'res',
88+
deep: 3,
7289
itemData: {},
7390
itemPath: ''
7491
}
@@ -91,10 +108,6 @@ export default {
91108
console.log('click', path, data, checked)
92109
this.itemPath = path
93110
this.itemData = !data ? data + '' : data // 处理 data = null 的情况
94-
},
95-
pathSelectableFn (path, data) {
96-
// return !(Array.isArray(data) && data.some(item => Array.isArray(item)))
97-
return true
98111
}
99112
}
100113
}
@@ -114,6 +127,9 @@ export default {
114127
.example-box {
115128
margin: 0 -15px;
116129
overflow: hidden;
130+
h3 {
131+
display: inline-block;
132+
}
117133
.title {
118134
text-align: center;
119135
}
@@ -123,25 +139,33 @@ export default {
123139
width: 50%;
124140
box-sizing: border-box;
125141
}
142+
input,
143+
select,
126144
textarea {
127-
padding: 5px;
128-
width: 100%;
129-
height: 150px;
145+
padding: 3px 8px;
130146
box-sizing: border-box;
131147
border-radius: 5px;
132-
resize: vertical;
148+
border: 1px solid #bbb;
133149
font-family: inherit;
134150
&:focus {
135151
outline: none;
136152
border-color: #1d8ce0;
137153
box-shadow: 0 0 3px #1d8ce0;
138154
}
139155
}
140-
pre{
156+
textarea {
157+
width: 100%;
158+
height: 150px;
159+
resize: vertical;
160+
}
161+
pre {
141162
margin: 0;
142163
font-family: Consolas;
143-
overflow: auto;
164+
overflow: hidden;
144165
text-overflow: ellipsis;
145166
}
167+
.options {
168+
font-size: 14px;
169+
}
146170
}
147171
</style>

0 commit comments

Comments
 (0)