[英]How to load quasar framework Globally
I am new to Quasar framework. 我是Quasar框架的新手。 Could someone explains how load quasar-components in Globally use. 有人可以解释一下如何在全球范围内使用类星体载荷。 (every where in my application) (在我的应用程序中的所有位置)
My main.js is like: 我的main.js像这样:
import Vue from 'vue'
import Quasar from 'quasar'
import router from './router'
require(`quasar/dist/quasar.${__THEME}.css`)
Vue.config.productionTip = false
Vue.use(Quasar) // Install Quasar Framework
if (__THEME === 'mat') {
require('quasar-extras/roboto-font')
}
import 'quasar-extras/material-icons'
// import 'quasar-extras/ionicons'
// import 'quasar-extras/fontawesome'
// import 'quasar-extras/animate'
Quasar.start(() => {
/* eslint-disable no-new */
new Vue({
el: '#q-app',
router,
render: h => h(require('./App').default)
})
})
Unknown custom element: <q-btn> - did you register the component correctly?
For recursive components, make sure to provide the "name" option.
found in
---> <App> at src\App.vue
<Root>
Whenever you're using any Quasar elements (eg. q-btn, q-select), you need to import and export it in your .vue file. 每当使用任何Quasar元素(例如q-btn,q-select)时,都需要将其导入和导出到.vue文件中。
Example, for a <q-btn>
to display, you might use <q-btn > Confirm </q-btn>
But to display that, you need to include following into your .vue file. 例如,要显示<q-btn>
,您可以使用<q-btn > Confirm </q-btn>
但是要显示该内容,您需要在.vue文件中包括以下内容。 Like: 喜欢:
import {
QSelect,
QBtn
} from 'quasar'
export {
QSelect,
QBtn
} from 'quasar'
Like this, you will be registering all your components. 这样,您将注册所有组件。
In my projects I import and use with components like this 在我的项目中,我导入并使用像这样的组件
import Quasar, { QBtn, QSelect } from 'quasar-framewok';
Vue.use(Quasar, {
components: { QBtn, QSelect }
});
import Quasar, * as All from 'quasar';
Vue.use(Quasar, {
components: All,
directives: All
});
See Quasar docs 请参阅Quasar文档
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.