How to write Default.vue in typescript?
-
I tried to write default.vue in typescript.
I covert:
<script>
export default {
name: ‘LayoutDefault’,
data() {
return {
leftDrawerOpen: this.$q.platform.is.desktop
}
}
}
</script>to be:
<script lang=“ts”>
import LayoutDefault from ‘./Default’
export default LayoutDefault
</script>and Default.ts:
import {
Component,
Vue,
} from ‘vue-property-decorator’
import { Platform } from ‘quasar’
@Component
export default class LayoutDefault extends Vue {
public leftDrawerOpen: boolean = false
}and I got error:
componentNormalizer.js?2877:24 Uncaught TypeError: Cannot set property ‘render’ of undefined
at normalizeComponent (componentNormalizer.js?2877:24)
at eval (Default.vue?c5dc:8)
at Module…/src/layouts/Default.vue (app.js:6629)
at webpack_require (app.js:724)
at fn (app.js:101)
at eval (router.ts:12)
at Module…/src/router.ts (app.js:6689)
at webpack_require (app.js:724)
at fn (app.js:101)
at eval (main.ts?cd49:1) -
If I remove Default.ts and put that code in Default.vue. The error will be gone, everything is fine.