Importing variable to vue file

Viewed 16388

I need import some variable to vue component file. I am doing it this way:

require('imports-loader?myVar=>{test:12345}!./my-com.vue');

As result I get [Vue warn]: Error in render function: "ReferenceError: myVar is not defined"

I know about props, but I want pass namely a variable.

Here "my-com.vue":

<template>
  <div>...</div>
</template>
<script>
  console.log(myVar); // <--- here I get vue warn
  export default {
    props:['rows'],
    ...
  }
</script>

Importing is from here:

module.exports = function(params){
  return function(resolve, reject){
    resolve({
      components:{
        'my-com': require('imports-loader?myVar=>{test:12345}!./my-com.vue')
      },
      ...
    })
  }
}

Where I am wrong?
How it possible to import a variable to vue component file?

Thanks in advance.

1 Answers
Related