| | |
| | | <template> |
| | | <div class="kline-page"> |
| | | <div |
| | | v-if="isVisible" |
| | | id="kline-BoxMain" |
| | | :style="{ width: width != 0 ? width + 'px' : '' }" |
| | | :class="[ |
| | |
| | | }, |
| | | data() { |
| | | return { |
| | | isVisible: true, |
| | | klineData: null, |
| | | paneId: undefined, |
| | | mssg: "", |
| | |
| | | }); |
| | | } |
| | | }, |
| | | "$route.query.timestamp"(newVal, oldVal) { |
| | | // 当 timestamp 参数变化时执行 |
| | | if (newVal !== oldVal) { |
| | | this.klineInIt(newVal); // 调用数据更新方法 |
| | | } |
| | | }, |
| | | }, |
| | | methods: { |
| | | klineInIt() { |
| | | klineInIt(newVal) { |
| | | if (this.klineData && newVal) { |
| | | this.klineData = null; |
| | | this.isVisible = false; |
| | | this.klineData.remove(); // 销毁旧的图表实例 |
| | | } |
| | | this.klineData = init("kline-BoxMain", { |
| | | locale: langStore.language, //https://klinecharts.com/guide/i18n.html |
| | | styles: { |
| | |
| | | }, |
| | | }, |
| | | }); |
| | | this.isVisible = true; |
| | | |
| | | this.klineData.createIndicator("MA", false, { |
| | | id: "candle_pane", |