Browse Source

Change javascript to typescript

pull/1251/head
Hironsan 3 years ago
parent
commit
b08b9301bd
9 changed files with 38 additions and 32 deletions
  1. 14
      frontend/components/comment/Comment.vue
  2. 8
      frontend/components/layout/FeatureCard.vue
  3. 9
      frontend/components/layout/FeatureCards.vue
  4. 4
      frontend/components/layout/LocaleMenu.vue
  5. 7
      frontend/components/layout/TheBottomBanner.vue
  6. 9
      frontend/components/layout/TheColorModeSwitcher.vue
  7. 9
      frontend/components/tasks/toolbar/forms/FormAutoLabeling.vue
  8. 8
      frontend/components/utils/ActionMenu.vue
  9. 2
      frontend/layouts/workspace.vue

14
frontend/components/comment/Comment.vue

@ -95,15 +95,14 @@
</v-card> </v-card>
</template> </template>
<script>
<script lang="ts">
import Vue from 'vue' import Vue from 'vue'
import VueFilterDateFormat from '@vuejs-community/vue-filter-date-format' import VueFilterDateFormat from '@vuejs-community/vue-filter-date-format'
import VueFilterDateParse from '@vuejs-community/vue-filter-date-parse' import VueFilterDateParse from '@vuejs-community/vue-filter-date-parse'
Vue.use(VueFilterDateFormat) Vue.use(VueFilterDateFormat)
Vue.use(VueFilterDateParse) Vue.use(VueFilterDateParse)
export default {
name: 'Comment',
export default Vue.extend({
props: { props: {
comment: { comment: {
required: true, required: true,
@ -114,26 +113,29 @@ export default {
type: Number type: Number
} }
}, },
data() { data() {
return { return {
showEdit: false, showEdit: false,
editText: this.comment.text, editText: this.comment.text,
commentRules: [ commentRules: [
v => !!v.trim() || 'Comment is required'
(v: string) => !!v.trim() || 'Comment is required'
], ],
valid: false valid: false
} }
}, },
methods: { methods: {
updateComment(newText) {
updateComment(newText: string) {
this.showEdit = false this.showEdit = false
const comment = {...this.comment, text:newText } const comment = {...this.comment, text:newText }
this.$emit('update-comment', comment) this.$emit('update-comment', comment)
}, },
cancel() { cancel() {
this.showEdit = false this.showEdit = false
this.editText = this.comment.text this.editText = this.comment.text
} }
} }
}
})
</script> </script>

8
frontend/components/layout/FeatureCard.vue

@ -15,8 +15,10 @@
</v-card> </v-card>
</template> </template>
<script>
export default {
<script lang="ts">
import Vue from 'vue'
export default Vue.extend({
props: { props: {
title: { title: {
type: String, type: String,
@ -34,5 +36,5 @@ export default {
required: true required: true
} }
} }
}
})
</script> </script>

9
frontend/components/layout/FeatureCards.vue

@ -35,10 +35,11 @@
</v-container> </v-container>
</template> </template>
<script>
import FeatureCard from './FeatureCard'
<script lang="ts">
import Vue from 'vue'
import FeatureCard from './FeatureCard.vue'
export default {
export default Vue.extend({
components: { components: {
FeatureCard FeatureCard
}, },
@ -64,5 +65,5 @@ export default {
] ]
} }
} }
}
})
</script> </script>

4
frontend/components/layout/LocaleMenu.vue

@ -26,7 +26,3 @@
</v-list> </v-list>
</v-menu> </v-menu>
</template> </template>
<script>
export default {}
</script>

7
frontend/components/layout/TheBottomBanner.vue

@ -61,8 +61,9 @@
</section> </section>
</template> </template>
<script>
export default {
<script lang="ts">
import Vue from 'vue'
export default Vue.extend({
data() { data() {
return { return {
items: [ items: [
@ -73,5 +74,5 @@ export default {
] ]
} }
} }
}
})
</script> </script>

9
frontend/components/layout/TheColorModeSwitcher.vue

@ -13,8 +13,9 @@
</v-btn> </v-btn>
</template> </template>
<script>
export default {
<script lang="ts">
import Vue from 'vue'
export default Vue.extend({
data() { data() {
return { return {
isDark: false isDark: false
@ -24,7 +25,7 @@ export default {
watch: { watch: {
isDark() { isDark() {
this.$vuetify.theme.dark = this.isDark this.$vuetify.theme.dark = this.isDark
localStorage.setItem('dark', this.isDark)
localStorage.setItem('dark', JSON.stringify(this.isDark))
} }
}, },
@ -32,5 +33,5 @@ export default {
const dark = localStorage.getItem('dark') const dark = localStorage.getItem('dark')
this.isDark = dark ? JSON.parse(dark) : false this.isDark = dark ? JSON.parse(dark) : false
} }
}
})
</script> </script>

9
frontend/components/tasks/toolbar/forms/FormAutoLabeling.vue

@ -24,10 +24,11 @@
</base-card> </base-card>
</template> </template>
<script>
import BaseCard from '@/components/utils/BaseCard'
<script lang="ts">
import Vue from 'vue'
import BaseCard from '@/components/utils/BaseCard.vue'
export default {
export default Vue.extend({
components: { components: {
BaseCard BaseCard
}, },
@ -44,5 +45,5 @@ export default {
required: true required: true
} }
} }
}
})
</script> </script>

8
frontend/components/utils/ActionMenu.vue

@ -29,8 +29,10 @@
</v-menu> </v-menu>
</template> </template>
<script>
export default {
<script lang="ts">
import Vue from 'vue'
export default Vue.extend({
props: { props: {
text: { text: {
type: String, type: String,
@ -42,5 +44,5 @@ export default {
required: true required: true
} }
} }
}
})
</script> </script>

2
frontend/layouts/workspace.vue

@ -17,7 +17,7 @@
/> />
</v-navigation-drawer> </v-navigation-drawer>
<v-main>
<v-main class="pb-0">
<nuxt /> <nuxt />
</v-main> </v-main>
</v-app> </v-app>

Loading…
Cancel
Save