๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

๐Ÿ’ก์›น ํ”„๋กœ์ ํŠธ/(ํ”„๋ก ํŠธ์—”๋“œ) ๋งˆ์ผ“์ปฌ๋ฆฌ - ํด๋ก ์ฝ”๋”ฉ

vue์— ๋ถ€ํŠธ์ŠคํŠธ๋žฉ ์ ์šฉ

https://bootstrap-vue.org/

 

BootstrapVue

Quickly integrate Bootstrap v4 components with Vue.js

bootstrap-vue.org

 


1. ํŒจํ‚ค์ง€ ์„ค์น˜

์ ์šฉํ•˜๊ณ ์ž ํ•˜๋Š” Vue ํ”„๋กœ์ ํŠธ์—์„œ bootstrap-vue ํŒจํ‚ค์ง€๋ฅผ ์„ค์น˜ํ•œ๋‹ค

npm install vue bootstrap-vue bootstrap

 

2. main.js์— ์ถ”๊ฐ€

Vue์—์„œ bootstrap-vue๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋„๋ก main.js์— bootstrap-vue๋ฅผ ์ถ”๊ฐ€ํ•œ๋‹ค.

import { BootstrapVue, IconsPlugin } from 'bootstrap-vue'
import 'bootstrap/dist/css/bootstrap.min.css' 
import 'bootstrap-vue/dist/bootstrap-vue.css' 

Vue.use(BootstrapVue)
Vue.use(IconsPlugin)

main.js์˜ ์ „์ฒด ์ฝ”๋“œ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™๋‹ค.

 

import Vue from 'vue'
import App from './App'
import router from './router'
import { BootstrapVue, IconsPlugin } from 'bootstrap-vue'
import 'bootstrap/dist/css/bootstrap.min.css' 
import 'bootstrap-vue/dist/bootstrap-vue.css' 

Vue.use(BootstrapVue)
Vue.use(IconsPlugin)
Vue.config.productionTip = false

new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>'
})

 

3. bootstrap-vue ์‚ฌ์šฉ

bootstap-vue์˜ ๋Œ€๋ถ€๋ถ„์˜ component๋Š” b- ๋กœ ์‹œ์ž‘ํ•œ๋‹ค. ๊ณต์‹๋ฌธ์„œ๋ฅผ ์ฐธ์กฐํ•˜์—ฌ ์›ํ•˜๋Š” component๋ฅผ ๊ฐ€์ ธ๋‹ค ์“ฐ๋ฉด ๋œ๋‹ค.

 

<template>
  <div id="app">
    <b-button>Button</b-button>
    <b-button variant="danger">Button</b-button>
    <b-button variant="success">Button</b-button>
    <b-button variant="outline-primary">Button</b-button>
  </div>
</template>

<script>
export default {
  name: 'app'
}
</script>

<style>
#app {

}
</style>

๊ฒฐ๊ณผ ํ™”๋ฉด