javascript - Where is the "vue entry point"? - Stack Overflow

I'm trying to get bootstrap-vue installed in my vue-cli project. I read here: Then, register Bo

I'm trying to get bootstrap-vue installed in my vue-cli project. I read here :

Then, register BootstrapVue in your app entry point:

import Vue from 'vue'
import { BootstrapVue, IconsPlugin } from 'bootstrap-vue'

// Install BootstrapVue
Vue.use(BootstrapVue)
// Optionally install the BootstrapVue icon ponents plugin
Vue.use(IconsPlugin)
And import Bootstrap and BootstrapVue css files:

import 'bootstrap/dist/css/bootstrap.css'
import 'bootstrap-vue/dist/bootstrap-vue.css'
Alternatively you can import Bootstrap and BootstrapVue scss files in a custom SCSS file:

@import 'node_modules/bootstrap/scss/bootstrap';
@import 'node_modules/bootstrap-vue/src/index.scss';
Make sure to import the custom.scss file in your app entry point:

import './custom.scss'
Be sure to @import or define your custom variable values before including Bootstrap SCSS (bootstrap.scss), and include BootstrapVue SCSS (bootstrap-vue.scss) after that to ensure variables are set up correctly.

Place all of the SCSS @imports into a single SCSS file, and import that single file into your project. Importing individual SCSS files into your project will not share variable values and functions between files by default.

Webpack and Parcel support prepending the scss modules with tilde paths (~) when importing from a scss file:

// Webpack example
@import '~bootstrap';
@import '~bootstrap-vue';
// Parcel example
@import '~bootstrap/scss/bootstrap';
@import '~bootstrap-vue/src/index.scss';
For more details how to configure asset loading and how modules are resolved, please consult the module bundlers documentation.

Well, where do I need to put all this? xD Im really new to vue.js. Is the main.js the entry point? And if so, do I need to put all this there? This is what my main.js looks like:

import VueResource from 'vue-resource'
import VueRouter from 'vue-router'
import Routes from './routes'
import App from './App.vue'
import Vue from 'vue'
import './style/customColor.scss';
//import 'regenerator-runtime';

import store from "./store/store";
import { USER_ROLECHECK } from './store/actions/user'
import { REQ_ADMIN_ROLE } from "./utility/namespaces";
import { BootstrapVue, IconsPlugin } from 'bootstrap-vue'

Vue.use(VueResource);
Vue.use(VueRouter);
Vue.config.devtools = true; //this line should be removed in the actual live build!

const router = new VueRouter({
    routes: Routes,
    mode: 'history'
})

router.beforeEach((to, from, next) => {
  if(to.meta.reqAuth){
    if(store.getters.isAuthenticated){
      if(to.meta.reqAdmin){
        store.dispatch(USER_ROLECHECK, REQ_ADMIN_ROLE).then(() =>{
          next();
        }).catch(() =>{
          next({path: '/'})
        })
      }else{
        next();
      }
    }else{
      next({path: '/login'});
    }
  }else{
    next();
  }
})

new Vue({
  el: '#app',
   router,
   store,
  render: h => h(App),
})

How do I need to update this, what must it look like for the integration to worK?

I'm trying to get bootstrap-vue installed in my vue-cli project. I read here https://bootstrap-vue.js/docs :

Then, register BootstrapVue in your app entry point:

import Vue from 'vue'
import { BootstrapVue, IconsPlugin } from 'bootstrap-vue'

// Install BootstrapVue
Vue.use(BootstrapVue)
// Optionally install the BootstrapVue icon ponents plugin
Vue.use(IconsPlugin)
And import Bootstrap and BootstrapVue css files:

import 'bootstrap/dist/css/bootstrap.css'
import 'bootstrap-vue/dist/bootstrap-vue.css'
Alternatively you can import Bootstrap and BootstrapVue scss files in a custom SCSS file:

@import 'node_modules/bootstrap/scss/bootstrap';
@import 'node_modules/bootstrap-vue/src/index.scss';
Make sure to import the custom.scss file in your app entry point:

import './custom.scss'
Be sure to @import or define your custom variable values before including Bootstrap SCSS (bootstrap.scss), and include BootstrapVue SCSS (bootstrap-vue.scss) after that to ensure variables are set up correctly.

Place all of the SCSS @imports into a single SCSS file, and import that single file into your project. Importing individual SCSS files into your project will not share variable values and functions between files by default.

Webpack and Parcel support prepending the scss modules with tilde paths (~) when importing from a scss file:

// Webpack example
@import '~bootstrap';
@import '~bootstrap-vue';
// Parcel example
@import '~bootstrap/scss/bootstrap';
@import '~bootstrap-vue/src/index.scss';
For more details how to configure asset loading and how modules are resolved, please consult the module bundlers documentation.

Well, where do I need to put all this? xD Im really new to vue.js. Is the main.js the entry point? And if so, do I need to put all this there? This is what my main.js looks like:

import VueResource from 'vue-resource'
import VueRouter from 'vue-router'
import Routes from './routes'
import App from './App.vue'
import Vue from 'vue'
import './style/customColor.scss';
//import 'regenerator-runtime';

import store from "./store/store";
import { USER_ROLECHECK } from './store/actions/user'
import { REQ_ADMIN_ROLE } from "./utility/namespaces";
import { BootstrapVue, IconsPlugin } from 'bootstrap-vue'

Vue.use(VueResource);
Vue.use(VueRouter);
Vue.config.devtools = true; //this line should be removed in the actual live build!

const router = new VueRouter({
    routes: Routes,
    mode: 'history'
})

router.beforeEach((to, from, next) => {
  if(to.meta.reqAuth){
    if(store.getters.isAuthenticated){
      if(to.meta.reqAdmin){
        store.dispatch(USER_ROLECHECK, REQ_ADMIN_ROLE).then(() =>{
          next();
        }).catch(() =>{
          next({path: '/'})
        })
      }else{
        next();
      }
    }else{
      next({path: '/login'});
    }
  }else{
    next();
  }
})

new Vue({
  el: '#app',
   router,
   store,
  render: h => h(App),
})

How do I need to update this, what must it look like for the integration to worK?

Share Improve this question asked Mar 18, 2020 at 7:48 NarktorNarktor 1,0371 gold badge19 silver badges36 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 6

Yes, in a vue-cli app, the main.js file is your apps entry point.

What you need to place in your main.js is the following:

import { BootstrapVue, IconsPlugin } from 'bootstrap-vue'

// Install BootstrapVue
Vue.use(BootstrapVue)
// Optionally install the BootstrapVue icon ponents plugin
// Only needed if you want to use the bootstrap icons. Be aware these are currently in alpha
Vue.use(IconsPlugin)


// Import Bootstrap and Bootstrap-Vue css
import 'bootstrap/dist/css/bootstrap.css'
import 'bootstrap-vue/dist/bootstrap-vue.css'

If you want to use SCSS you will need to create a new styles.scss (the name doesn't matter) file, place these two lines in it

@import 'node_modules/bootstrap/scss/bootstrap';
@import 'node_modules/bootstrap-vue/src/index.scss';

and then import styles.scss in your main.js instead of the css files:

// Replace these
import 'bootstrap/dist/css/bootstrap.css'
import 'bootstrap-vue/dist/bootstrap-vue.css'

// With this
import './path/to/your/styles.scss'

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745488309a4629869.html

相关推荐

  • javascript - Where is the "vue entry point"? - Stack Overflow

    I'm trying to get bootstrap-vue installed in my vue-cli project. I read here: Then, register Bo

    8小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信