Skip to content

Commit

Permalink
Merge pull request ramp4-pcar4#4 from yileifeng/update-class-component
Browse files Browse the repository at this point in the history
Update vue class component + property decorator
  • Loading branch information
yileifeng authored Aug 17, 2023
2 parents ca29209 + bf57889 commit f889345
Show file tree
Hide file tree
Showing 22 changed files with 44 additions and 50 deletions.
12 changes: 9 additions & 3 deletions src/app.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
<template>
<div id="app" class="storyramp-app bg-white">
<router-view :key="$route.path"></router-view>
<!-- <router-view :key="$route.path"></router-view> -->
<story></story>
</div>
</template>

<script lang="ts">
import { Component, Vue } from 'vue-property-decorator';
import { Options, Vue } from 'vue-property-decorator';
import StoryV from '@storylines/components/story/story.vue';
@Component({})
@Options({
components: {
story: StoryV
}
})
export default class App extends Vue {}
</script>

Expand Down
3 changes: 1 addition & 2 deletions src/components/panels/audio-panel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@

<script lang="ts">
import { AudioPanel } from '@storylines/definitions';
import { Component, Prop, Vue } from 'vue-property-decorator';
import { Prop, Vue } from 'vue-property-decorator';
@Component({})
export default class AudioPanelV extends Vue {
@Prop() config!: AudioPanel;
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/panels/chart-panel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@
</template>

<script lang="ts">
import { Component, Prop, Vue } from 'vue-property-decorator';
import { Options, Prop, Vue } from 'vue-property-decorator';
import { ChartPanel, ConfigFileStructure } from '@storylines/definitions';
import { Hooper, Navigation as HooperNavigation, Pagination as HooperPagination, Slide } from 'hooper';
import 'hooper/dist/hooper.css';
import ChartV from '@storylines/components/panels/helpers/chart.vue';
@Component({
@Options({
components: {
'dqv-chart': ChartV,
Hooper,
Expand Down
4 changes: 2 additions & 2 deletions src/components/panels/dynamic-panel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@
import Scrollama from 'vue-scrollama';
import MarkdownIt from 'markdown-it';
import { Component, Prop, Vue } from 'vue-property-decorator';
import { Options, Prop, Vue } from 'vue-property-decorator';
import { BasePanel, DynamicPanel } from '@storylines/definitions';
@Component({
@Options({
components: {
panel: () => import('./panel.vue'),
Scrollama
Expand Down
4 changes: 2 additions & 2 deletions src/components/panels/helpers/chart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</template>

<script lang="ts">
import { Component, Prop, Vue } from 'vue-property-decorator';
import { Options, Prop, Vue } from 'vue-property-decorator';
import {
ChartConfig,
ConfigFileStructure,
Expand All @@ -40,7 +40,7 @@ interface CSVDataRow {
[column: string]: string | number;
}
@Component({
@Options({
components: {
highcharts: Chart
}
Expand Down
3 changes: 1 addition & 2 deletions src/components/panels/helpers/fullscreen.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,8 @@
</template>

<script lang="ts">
import { Component, Prop, Vue } from 'vue-property-decorator';
import { Prop, Vue } from 'vue-property-decorator';
@Component
export default class FullscreenV extends Vue {
@Prop() expandable!: boolean;
@Prop() type!: string;
Expand Down
3 changes: 1 addition & 2 deletions src/components/panels/helpers/scrollguard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
</template>

<script lang="ts">
import { Component, Prop, Vue } from 'vue-property-decorator';
import { Prop, Vue } from 'vue-property-decorator';
@Component
export default class Scrollguard extends Vue {
@Prop() lang!: string;
}
Expand Down
3 changes: 1 addition & 2 deletions src/components/panels/helpers/time-slider.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,10 @@
</template>

<script lang="ts">
import { Component, Prop, Vue } from 'vue-property-decorator';
import { Prop, Vue } from 'vue-property-decorator';
import { TimeSliderConfig } from '@storylines/definitions';
import noUiSlider, { API, PipsMode } from 'nouislider';
@Component
export default class TimeSlider extends Vue {
@Prop() config!: TimeSliderConfig;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand Down
4 changes: 2 additions & 2 deletions src/components/panels/image-panel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@

<script lang="ts">
import { ImagePanel } from '@storylines/definitions';
import { Component, Prop, Vue } from 'vue-property-decorator';
import { Options, Prop, Vue } from 'vue-property-decorator';
import MarkdownIt from 'markdown-it';
import FullscreenV from '@storylines/components/panels/helpers/fullscreen.vue';
@Component({
@Options({
components: {
'full-screen': FullscreenV
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/panels/loading-panel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

<script lang="ts">
import Scrollama from 'vue-scrollama';
import { Component, Vue } from 'vue-property-decorator';
import { Options, Vue } from 'vue-property-decorator';
// import Circle2 from 'vue-loading-spinner/src/components/Circle2.vue';
@Component({
@Options({
components: {
Scrollama
// spinner: Circle2
Expand Down
5 changes: 1 addition & 4 deletions src/components/panels/map-panel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,11 @@

<script lang="ts">
import { ConfigFileStructure, MapPanel } from '@storylines/definitions';
import { Component, Prop, Vue } from 'vue-property-decorator';
import { Prop, Vue } from 'vue-property-decorator';
import TimeSlider from '@storylines/components/panels/helpers/time-slider.vue';
import Scrollguard from '@storylines/components/panels/helpers/scrollguard.vue';
@Component({
components: {}
})
export default class MapPanelV extends Vue {
@Prop() config!: MapPanel;
@Prop() slideIdx!: number;
Expand Down
9 changes: 4 additions & 5 deletions src/components/panels/panel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
</template>

<script lang="ts">
import { Component, Prop, Vue } from 'vue-property-decorator';
import { VueConstructor } from 'vue/types/umd';
import { Options, Prop, Vue } from 'vue-property-decorator';
import { BasePanel, ConfigFileStructure, PanelType } from '@storylines/definitions';
import TextPanelV from './text-panel.vue';
Expand All @@ -34,7 +33,7 @@ import ChartPanelV from './chart-panel.vue';
import DynamicPanelV from './dynamic-panel.vue';
import LoadingPanelV from './loading-panel.vue';
@Component({
@Options({
components: {
TextPanelV
}
Expand All @@ -49,8 +48,8 @@ export default class PanelV extends Vue {
/**
* Returns the corresponding component for this panel.
*/
getTemplate(): VueConstructor {
const panelTemplates: Record<PanelType | string, VueConstructor> = {
getTemplate(): typeof Vue {
const panelTemplates: Record<PanelType | string, typeof Vue> = {
[PanelType.Text]: TextPanelV,
[PanelType.Map]: MapPanelV,
[PanelType.Image]: ImagePanelV,
Expand Down
4 changes: 2 additions & 2 deletions src/components/panels/slideshow-panel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
</template>

<script lang="ts">
import { Component, Prop, Vue } from 'vue-property-decorator';
import { Options, Prop, Vue } from 'vue-property-decorator';
import { ConfigFileStructure, SlideshowPanel } from '@storylines/definitions';
import { Hooper, Navigation as HooperNavigation, Pagination as HooperPagination, Slide } from 'hooper';
import 'hooper/dist/hooper.css';
Expand All @@ -49,7 +49,7 @@ import MarkdownIt from 'markdown-it';
import FullscreenV from '@storylines/components/panels/helpers/fullscreen.vue';
import ImagePanelV from '@storylines/components/panels/image-panel.vue';
@Component({
@Options({
components: {
Hooper,
Slide,
Expand Down
4 changes: 2 additions & 2 deletions src/components/panels/text-panel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
import Scrollama from 'vue-scrollama';
import MarkdownIt from 'markdown-it';
import { Component, Prop, Vue } from 'vue-property-decorator';
import { Options, Prop, Vue } from 'vue-property-decorator';
import { TextPanel } from '@storylines/definitions';
@Component({
@Options({
components: {
Scrollama
}
Expand Down
3 changes: 1 addition & 2 deletions src/components/panels/video-panel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,8 @@
import MarkdownIt from 'markdown-it';
import { VideoPanel } from '@storylines/definitions';
import { Component, Vue, Prop } from 'vue-property-decorator';
import { Vue, Prop } from 'vue-property-decorator';
@Component({})
export default class VideoPanelV extends Vue {
@Prop() config!: VideoPanel;
Expand Down
3 changes: 1 addition & 2 deletions src/components/story/chapter-menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,9 @@
</template>

<script lang="ts">
import { Component, Prop, Vue } from 'vue-property-decorator';
import { Prop, Vue } from 'vue-property-decorator';
import { Slide } from '@storylines/definitions';
@Component
export default class ChapterMenuV extends Vue {
@Prop() slides!: Slide[];
@Prop() activeChapterIndex!: number;
Expand Down
3 changes: 1 addition & 2 deletions src/components/story/introduction.vue
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,8 @@

<script lang="ts">
import { ConfigFileStructure, Intro } from '@storylines/definitions';
import { Component, Prop, Vue } from 'vue-property-decorator';
import { Prop, Vue } from 'vue-property-decorator';
@Component({})
export default class IntroV extends Vue {
@Prop() config!: Intro;
@Prop() configFileStructure!: ConfigFileStructure;
Expand Down
3 changes: 1 addition & 2 deletions src/components/story/mobile-menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,9 @@
</template>

<script lang="ts">
import { Component, Prop, Vue } from 'vue-property-decorator';
import { Prop, Vue } from 'vue-property-decorator';
import { Slide } from '@storylines/definitions';
@Component
export default class SideMenuV extends Vue {
@Prop() slides!: Slide[];
@Prop() activeChapterIndex!: number;
Expand Down
4 changes: 2 additions & 2 deletions src/components/story/slide.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
</template>

<script lang="ts">
import { Component, Prop, Vue } from 'vue-property-decorator';
import { Options, Prop, Vue } from 'vue-property-decorator';
import { ConfigFileStructure, PanelType, Slide } from '@storylines/definitions';
import PanelV from '@storylines/components/panels/panel.vue';
@Component({
@Options({
components: {
panel: PanelV
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/story/story-content.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@
<script lang="ts">
import 'intersection-observer';
import Scrollama from 'vue-scrollama';
import { Component, Prop, Vue } from 'vue-property-decorator';
import { Options, Prop, Vue } from 'vue-property-decorator';
import { ConfigFileStructure, StoryRampConfig } from '@storylines/definitions';
import ChapterMenuV from './chapter-menu.vue';
import SlideV from './slide.vue';
@Component({
@Options({
components: {
Scrollama,
ChapterMenuV,
Expand Down
4 changes: 2 additions & 2 deletions src/components/story/story.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
</template>

<script lang="ts">
import { Component, Vue } from 'vue-property-decorator';
import { Options, Vue } from 'vue-property-decorator';
import { Route } from 'vue-router';
import MobileMenuV from './mobile-menu.vue';
Expand All @@ -70,7 +70,7 @@ import IntroV from '@storylines/components/story/introduction.vue';
import { StoryRampConfig } from '@storylines/definitions';
// import Circle2 from 'vue-loading-spinner/src/components/Circle2.vue';
@Component({
@Options({
components: {
StoryContentV,
MobileMenuV,
Expand Down
4 changes: 2 additions & 2 deletions src/router/componentHooks.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Component from 'vue-class-component';
import { Vue } from 'vue-class-component';

// register router hooks
Component.registerHooks(['beforeRouterEnter', 'beforeRouteLeave', 'beforeRouteUpdate']);
Vue.registerHooks(['beforeRouterEnter', 'beforeRouteLeave', 'beforeRouteUpdate']);

0 comments on commit f889345

Please sign in to comment.