Files
vueecharts/demo/examples/Example.vue
Yue JIN 1a05e28177 feat: rendering tooltips and dataView with slots (#838)
* feat: experimental component rendered tooltip

* revert slot in VChart

* feat: use tooltip composable

* feat: try createApp

* feat: use pie chart as tooltip

* feat: switch to createVNode

The limitation is that the tooltip detached from the current component tree, not provide/inject

will try teleport next

* feat: try component with teleport

* wip

* add xAxis example

* refactor with shallowReactive

* Support dynamic slot

* fix: fill empty elements with object in array

* shallow copy option along the path

* ssr friendly

* vibe docs

* typo

* update according to the review

* add dataView slot

* chore: fix warnings and errors in demo (#839)

* chore: suppress warning in demo

* chore: prevent multiple intializations of esbuild-wasm in demo HMR

* feat: dynamically update the theme (#841)

Co-authored-by: GU Yiling <justice360@gmail.com>

* feat: add dataView slot

* vibe docs

---------

Co-authored-by: GU Yiling <justice360@gmail.com>

* fix docs typo

* update according to the review

* small fix

* remove wrapper around slotProp

* update comments

* remove anys

* add tooltip slot prop type

* target to vue 3.3

* move slot related codes to slot.ts

---------

Co-authored-by: GU Yiling <justice360@gmail.com>
2025-07-26 01:30:58 +08:00

96 lines
1.4 KiB
Vue

<template>
<h3 :id="id">
<a :href="`#${id}`">
{{ title }}
<small v-if="desc">{{ desc }}</small>
</a>
</h3>
<section>
<figure class="fig hero" v-if="!split">
<slot />
</figure>
<div class="split" v-else>
<figure class="fig half">
<slot name="start" />
</figure>
<figure class="fig half">
<slot name="end" />
</figure>
</div>
<slot name="extra" />
</section>
</template>
<script setup>
defineProps({
id: {
type: String,
required: true,
},
title: {
type: String,
required: true,
},
desc: String,
split: Boolean,
});
</script>
<style>
.fig {
display: flex;
justify-content: center;
width: fit-content;
margin: 2em auto;
> .echarts {
width: calc(60vw + 4em);
height: 360px;
max-width: 720px;
border: 1px solid rgba(0, 0, 0, 0.1);
border-radius: 8px;
box-shadow: 0 0 45px rgba(0, 0, 0, 0.2);
}
}
.split {
display: flex;
justify-content: center;
.fig {
margin-right: 0;
margin-left: 0;
}
}
@media (max-width: 980px) {
.fig {
width: 100vw;
margin: 1em auto;
.echarts {
width: 100%;
min-width: 0;
height: 60vw;
border: none;
border-radius: 0;
box-shadow: none;
}
}
}
@media (min-width: 980px) {
.fig.half {
.echarts {
width: 28vw;
min-width: 240px;
height: 180px;
}
& + & {
margin-left: 30px;
}
}
}
</style>