feat: 更新 @riwa/api-types 依赖至 0.0.89,优化交易对和图表组件

This commit is contained in:
2026-01-08 00:02:56 +07:00
parent d3285363f0
commit babd307b60
5 changed files with 30 additions and 19 deletions

View File

@@ -68,6 +68,9 @@ const defaultOptions = {
},
} satisfies ChartingLibraryWidgetOptions;
export interface TradingViewChartExpose {
}
export const TradingViewChart = defineComponent({
name: "TradingViewChart",
props: {
@@ -141,6 +144,17 @@ export const TradingViewChart = defineComponent({
}, 0);
});
// 监听交易对变化,动态更新图表数据
watch(() => props.symbol, (newSymbol) => {
if (!widget.value || !newSymbol)
return;
widget.value.activeChart().setSymbol(newSymbol, () => {
console.log(`[TradingView]: Symbol changed to ${newSymbol}`);
});
});
return () => h("div", { ref: el, class: "w-full", style: styles.value });
},
});
export type TradingViewInst = InstanceType<typeof TradingViewChart> & TradingViewChartExpose;