Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release #167

Merged
merged 12 commits into from
May 11, 2022
Merged
23 changes: 22 additions & 1 deletion example/Basic.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@
<label>deepCollapseChildren</label>
<input v-model="state.deepCollapseChildren" type="checkbox" />
</div>
<div>
<label>defaultCollapsePath</label>
<input v-model="state.collapsePathPattern" type="input" />
</div>
</div>
</div>
<div class="block">
Expand All @@ -46,6 +50,7 @@
:data="state.data"
:deep="state.deep"
:deepCollapseChildren="state.deepCollapseChildren"
:collapsePath="state.collapsePath"
:show-double-quotes="state.showDoubleQuotes"
:show-length="state.showLength"
:show-line="state.showLine"
Expand Down Expand Up @@ -75,6 +80,9 @@ const defaultData = {
'Traffic paradise: How to design streets for people and unmanned vehicles in the future?',
source: 'Netease smart',
link: 'http://netease.smart/traffic-paradise/1235',
author: {
names: ['Daniel', 'Mike', 'John'],
},
},
{
news_id: 51182,
Expand All @@ -100,8 +108,10 @@ export default defineComponent({
showDoubleQuotes: true,
collapsedOnClickBrackets: true,
useCustomLinkFormatter: false,
deep: 3,
deep: 4,
deepCollapseChildren: false,
collapsePath: /members/,
collapsePathPattern: 'members',
});

const customLinkFormatter = (data, key, path, defaultFormatted) => {
Expand All @@ -123,6 +133,17 @@ export default defineComponent({
},
);

watch(
() => state.collapsePath,
newVal => {
try {
state.collapsePath = new RegExp(newVal);
} catch (err) {
// console.log('Regexp ERROR');
}
},
);

return {
state,
customLinkFormatter,
Expand Down
9 changes: 9 additions & 0 deletions example/SelectControl.vue
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,15 @@ export default defineComponent({
},
);

watch(
() => state.useCustomLinkFormatter,
async () => {
state.renderOK = false;
await nextTick();
state.renderOK = true;
},
);

return {
state,
customLinkFormatter,
Expand Down
Loading