Skip to content

Commit 37fdb31

Browse files
committed
chore: change classname style.
1 parent c26760e commit 37fdb31

File tree

14 files changed

+153
-49
lines changed

14 files changed

+153
-49
lines changed

example/App.tsx

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,35 @@ import Basic from './Basic.vue';
33
import VirtualList from './VirtualList.vue';
44
import SelectControl from './SelectControl.vue';
55
import Editable from './Editable.vue';
6+
// import Tsx from './Tsx';
67
import './styles.less';
78

89
const list = [
910
{
1011
title: 'Basic Use',
11-
key: 'basic',
12+
key: 'Basic',
1213
component: Basic,
1314
},
1415
{
1516
title: 'Virtual List',
16-
key: 'virtual-list',
17+
key: 'VirtualList',
1718
component: VirtualList,
1819
},
1920
{
2021
title: 'Selector',
21-
key: 'select-control',
22+
key: 'Selector',
2223
component: SelectControl,
2324
},
2425
{
2526
title: 'Editable',
26-
key: 'editable',
27+
key: 'Editable',
2728
component: Editable,
2829
},
30+
// {
31+
// title: 'Tsx',
32+
// key: 'Tsx',
33+
// component: Tsx,
34+
// },
2935
];
3036

3137
export default defineComponent({
@@ -80,19 +86,6 @@ export default defineComponent({
8086
))}
8187
</div>
8288
</div>
83-
84-
<a
85-
style="position: fixed; right: 0; top: 0;"
86-
href="https://github.com/leezng/vue-json-pretty"
87-
target="_blank"
88-
>
89-
<img
90-
style="position: absolute; top: 0; right: 0; border: 0;"
91-
src="https://camo.githubusercontent.com/652c5b9acfaddf3a9c326fa6bde407b87f7be0f4/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6f72616e67655f6666373630302e706e67"
92-
alt="Fork me on GitHub"
93-
data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_orange_ff7600.png"
94-
/>
95-
</a>
9689
</div>
9790
);
9891
},

example/Basic.vue

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@
3030
<label>collapsedOnClickBrackets</label>
3131
<input v-model="state.collapsedOnClickBrackets" type="checkbox" />
3232
</div>
33-
<div>
34-
<label>useRenderNodeValue</label>
35-
<input v-model="state.useRenderNodeValue" type="checkbox" />
36-
</div>
3733
<div>
3834
<label>deep</label>
3935
<select v-model="state.deep">
@@ -47,13 +43,21 @@
4743
<input v-model="state.setPathCollapsible" type="checkbox" />
4844
</div>
4945
</div>
46+
47+
<h3>Slots:</h3>
48+
<div class="options">
49+
<div>
50+
<label>renderNodeValue</label>
51+
<input v-model="state.useRenderNodeValueSlot" type="checkbox" />
52+
</div>
53+
</div>
5054
</div>
5155
<div class="block">
5256
<h3>vue-json-pretty:</h3>
5357
<vue-json-pretty
5458
:data="state.data"
5559
:deep="state.deep"
56-
:path-collapsible="setPathCollapsible ? pathCollapsible : undefined"
60+
:path-collapsible="state.setPathCollapsible ? pathCollapsible : undefined"
5761
:show-double-quotes="state.showDoubleQuotes"
5862
:show-length="state.showLength"
5963
:show-line="state.showLine"
@@ -62,7 +66,7 @@
6266
:show-icon="state.showIcon"
6367
style="position: relative"
6468
>
65-
<template v-if="state.useRenderNodeValue" #renderNodeValue="{ node, defaultValue }">
69+
<template v-if="state.useRenderNodeValueSlot" #renderNodeValue="{ node, defaultValue }">
6670
<template v-if="typeof node.content === 'string' && node.content.startsWith('http://')">
6771
<a :href="node.content" target="_blank">{{ node.content }}</a>
6872
</template>
@@ -117,7 +121,7 @@ export default defineComponent({
117121
showLineNumber: false,
118122
showDoubleQuotes: true,
119123
collapsedOnClickBrackets: true,
120-
useRenderNodeValue: false,
124+
useRenderNodeValueSlot: false,
121125
deep: 4,
122126
setPathCollapsible: false,
123127
showIcon: false,

example/Tsx.tsx

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import { defineComponent, reactive } from 'vue';
2+
import VueJsonPretty from 'src';
3+
4+
const defaultData = {
5+
status: 200,
6+
data: [
7+
{
8+
news_id: 51184,
9+
link: 'http://netease.smart/traffic-paradise/51184',
10+
},
11+
{
12+
news_id: 51183,
13+
link: 'http://netease.smart/traffic-paradise/51183',
14+
},
15+
],
16+
};
17+
18+
export default defineComponent({
19+
setup() {
20+
const state = reactive({
21+
data: defaultData,
22+
});
23+
24+
return () => (
25+
<VueJsonPretty
26+
data={state.data}
27+
showLineNumber
28+
showIcon
29+
renderNodeValue={({ node, defaultValue }) =>
30+
typeof node.content === 'string' && node.content?.startsWith('http://') ? (
31+
<a href={node.content} target="_blank">
32+
{node.content}
33+
</a>
34+
) : (
35+
defaultValue
36+
)
37+
}
38+
/>
39+
);
40+
},
41+
});

example/index.html

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,65 @@
11
<!DOCTYPE html>
22
<html>
33
<head>
4-
<meta charset="utf-8">
4+
<meta charset="utf-8" />
55
<title>vue-json-pretty</title>
66
</head>
77
<body>
88
<div id="app"></div>
99
<!-- built files will be auto injected -->
10+
<a
11+
href="https://github.com/leezng/vue-json-pretty"
12+
target="_blank"
13+
class="github-corner"
14+
aria-label="View source on GitHub"
15+
>
16+
<svg
17+
width="80"
18+
height="80"
19+
viewBox="0 0 250 250"
20+
style="fill: #151513; color: #fff; position: absolute; top: 0; border: 0; right: 0"
21+
aria-hidden="true"
22+
>
23+
<path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path>
24+
<path
25+
d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2"
26+
fill="currentColor"
27+
style="transform-origin: 130px 106px"
28+
class="octo-arm"
29+
></path>
30+
<path
31+
d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z"
32+
fill="currentColor"
33+
class="octo-body"
34+
></path>
35+
</svg>
36+
</a>
37+
<style>
38+
.github-corner:hover .octo-arm {
39+
animation: octocat-wave 560ms ease-in-out;
40+
}
41+
@keyframes octocat-wave {
42+
0%,
43+
100% {
44+
transform: rotate(0);
45+
}
46+
20%,
47+
60% {
48+
transform: rotate(-25deg);
49+
}
50+
40%,
51+
80% {
52+
transform: rotate(10deg);
53+
}
54+
}
55+
@media (max-width: 500px) {
56+
.github-corner:hover .octo-arm {
57+
animation: none;
58+
}
59+
.github-corner .octo-arm {
60+
animation: octocat-wave 560ms ease-in-out;
61+
}
62+
}
63+
</style>
1064
</body>
1165
</html>

src/components/Brackets/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export default defineComponent({
1616
const { onClick } = this;
1717

1818
return (
19-
<span class="vjs-tree__brackets" onClick={onClick}>
19+
<span class="vjs-tree-brackets" onClick={onClick}>
2020
{data}
2121
</span>
2222
);

src/components/Brackets/styles.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@import '~src/themes.less';
22

3-
.@{css-prefix}-tree__brackets {
3+
.@{css-prefix}-tree-brackets {
44
cursor: pointer;
55
&:hover {
66
color: @color-primary;

src/components/Carets/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export default defineComponent({
2222
if (!isOpen && !isClose) return null;
2323

2424
return (
25-
<span class={`vjs-carets vjs-carets__${isOpen ? 'open' : 'close'}`} onClick={onClick}>
25+
<span class={`vjs-carets vjs-carets-${isOpen ? 'open' : 'close'}`} onClick={onClick}>
2626
<svg
2727
viewBox="0 0 1024 1024"
2828
focusable="false"

src/components/Carets/styles.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@
1414
}
1515
}
1616

17-
.@{css-prefix}-carets__close {
17+
.@{css-prefix}-carets-close {
1818
transform: rotate(-90deg);
1919
}

src/components/CheckController/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ export default defineComponent({
3535
class={[`vjs-check-controller`, model ? 'is-checked' : '']}
3636
onClick={e => e.stopPropagation()}
3737
>
38-
<span class={`vjs-check-controller__inner is-${uiType}`} />
38+
<span class={`vjs-check-controller-inner is-${uiType}`} />
3939
<input
4040
checked={model}
41-
class={`vjs-check-controller__original is-${uiType}`}
41+
class={`vjs-check-controller-original is-${uiType}`}
4242
type={uiType}
4343
onChange={() => $emit('change', model)}
4444
/>

src/components/CheckController/styles.less

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
position: absolute;
55
left: 0;
66

7-
&.is-checked .@{css-prefix}-check-controller__inner {
7+
&.is-checked .@{css-prefix}-check-controller-inner {
88
background-color: @color-primary;
99
border-color: darken(@color-primary, 10%);
1010

@@ -17,7 +17,7 @@
1717
}
1818
}
1919

20-
.@{css-prefix}-check-controller__inner {
20+
.@{css-prefix}-check-controller-inner {
2121
display: inline-block;
2222
position: relative;
2323
border: 1px solid @border-color;
@@ -61,7 +61,7 @@
6161
}
6262
}
6363

64-
.@{css-prefix}-check-controller__original {
64+
.@{css-prefix}-check-controller-original {
6565
opacity: 0;
6666
outline: none;
6767
position: absolute;

0 commit comments

Comments
 (0)