No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    How to write Default.vue in typescript?

    Framework
    1
    2
    472
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • 1
      1cf2 last edited by

      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)

      1 Reply Last reply Reply Quote 0
      • 1
        1cf2 last edited by

        If I remove Default.ts and put that code in Default.vue. The error will be gone, everything is fine.

        1 Reply Last reply Reply Quote 0
        • First post
          Last post