Asynchronously request data, according to the request data require component

I am working on a page customization function. The template is stored in the background database, so you need to pull the template id, from the background and then follow the template id require corresponding to the components in the directory. For example,

require"/template"+tempid+"index.vue"

tempid is not known until it is requested.
I have found a lot of similar cases on the Internet, and some of them say to use

.
component: resolve => require(["component"], promise => promise.then(resolve))

component returns a promise, where then callback returns the final component

I am a beginner in vue, and I look confused and ask for advice


use vue-router beforeRouteEnter


Asynchronous problems can be solved by using beforeRouteEnter
beforeRouteEnter (to, from, next) {

request.get(url, {})
  .then(function (res) {
    info = res
    next()
  })
  .catch(function (error) {
    console.log(error)
  })

},

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1be941a-13ea4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1be941a-13ea4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?