From 8592961606bdf0b51da14d33c7621a6603830ed4 Mon Sep 17 00:00:00 2001 From: chenxianhui Date: Wed, 22 May 2024 09:23:24 +0800 Subject: [PATCH] =?UTF-8?q?ISVJ-8206=20=E5=9C=B0=E5=9B=BE=E5=A4=A7?= =?UTF-8?q?=E5=B1=8F=E6=97=B6=E9=97=B4=E8=BD=B4=E7=82=B9=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E4=B8=8D=E5=85=A8=20review=20by=20luox?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/time-line/TimeLine.vue | 11 ++++++++--- src/common/time-line/__tests__/TimeLine.spec.js | 13 +++++++++++++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/common/time-line/TimeLine.vue b/src/common/time-line/TimeLine.vue index 810d8aad..fc10e293 100644 --- a/src/common/time-line/TimeLine.vue +++ b/src/common/time-line/TimeLine.vue @@ -50,6 +50,10 @@ export default class SmTimeLine extends Mixins(Theme) { @Prop({ default: true }) loop: boolean; @Prop({ default: 3000 }) playInterval: string | number; @Prop({ default: 0 }) currentIndex: number; + @Prop({ default: 'auto' }) left: string | number; + @Prop({ default: 'auto' }) right: string | number; + @Prop({ default: 'auto' }) top: string | number; + @Prop({ default: 'auto' }) bottom: string | number; @Prop({ default() { return []; @@ -168,9 +172,10 @@ export default class SmTimeLine extends Mixins(Theme) { ...(this.emphasis || {}) }, padding: 0, - left: 0, - right: 0, - top: 'middle' + left: this.left, + right: this.right, + top: this.top, + bottom: this.bottom }, tooltip: { position: function(point, params, dom, rect, size) { diff --git a/src/common/time-line/__tests__/TimeLine.spec.js b/src/common/time-line/__tests__/TimeLine.spec.js index 21179b37..f215eb59 100644 --- a/src/common/time-line/__tests__/TimeLine.spec.js +++ b/src/common/time-line/__tests__/TimeLine.spec.js @@ -152,4 +152,17 @@ describe('TimeLine.vue', () => { }); wrapper.vm.setPlayState(true); }); + + it('render margin', async () => { + wrapper = mount(SmTimeLine, { + propsData: { + data: ['3月15号数据', '3月16号数据', '3月17号数据'], + left: 20, + right: 20, + top: 20, + bottom: 20 + } + }); + expect(wrapper.vm.options.baseOption.timeline.left).toBe(20); + }); });