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

    Import Dexie Version From Another Page

    Help
    2
    5
    204
    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.
    • C
      cynderkromi last edited by

      I am building a mutli-page Quasar application and I’m using Dexie. I seem to have to initialize the database and the version on every page.

      Is there a way to create a .vue file that has the DB connection and version information, and import it into every page? Having to go through every page to update the version of the db is not going to work for me. I plan on having quite a few pages to keep everything organized. I don’t really understand what is needed for importing a page.

      This is my script to connect to Dexie:

      import Dexie from 'dexie';
      var pawTapDB = new Dexie('pawTapDB')
      pawTapDB.version(1.5).stores({
              peopleTable: '++p_key,l_name,p_email',
              tableHoldPersonID: '++thpid_key',
              dogTable: '++p_dog,callName'
          })
      
      metalsadman 1 Reply Last reply Reply Quote 0
      • metalsadman
        metalsadman @cynderkromi last edited by metalsadman

        @cynderkromi do it in a boot file, this example should help you get an idea https://quasar.dev/quasar-cli/boot-files#Accessing-data-from-boot-files.

        C 2 Replies Last reply Reply Quote 0
        • C
          cynderkromi @metalsadman last edited by

          @metalsadman Thanks I will check that out.

          1 Reply Last reply Reply Quote 0
          • C
            cynderkromi @metalsadman last edited by cynderkromi

            @metalsadman I tried the boot file, but when I try to run my project, it doesn’t like my call to Dexie in the boot file.
            Really wish I could just include the file into all my other files.

            alt text

            1 Reply Last reply Reply Quote 0
            • C
              cynderkromi last edited by

              I figured it out.

              I am including my Dexie connect file as a .js file

              import pawTapDB from '../components/DexieConnect.js'
              
              

              and this is my DexieConnect.js file, if anyone else has this issue:

              import Dexie from 'dexie'
              const pawTapDB = new Dexie('pawTapDB')
              
              pawTapDB.version(20).stores({
                  peopleTable: '++p_key,l_name,p_email',
                  tableHoldPersonID: '++thpid_key',
                  dogTable: '++p_dog,callName',
                  tableHoldDogID: '++thdid_key',
                  locationTable: '++pk_location, locationName',
                  clubTable: '++pk_club'
              })
              
              export default pawTapDB
              
              1 Reply Last reply Reply Quote 2
              • First post
                Last post