bootstrap-vue-top 1.1.0 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/README.md +20 -43
  2. package/dist/bootstrap-vue-top.umd.cjs +3 -0
  3. package/package.json +12 -11
  4. package/src/components/accordion/accordion-item.vue +27 -0
  5. package/src/components/accordion/accordion-keys.js +1 -0
  6. package/src/components/accordion/accordion.vue +84 -0
  7. package/src/components/alert/alert.js +10 -0
  8. package/src/components/alert-box/alert-box.vue +73 -0
  9. package/src/components/alert-box/index.js +25 -0
  10. package/src/components/alert-confirm/alert-confirm.vue +80 -0
  11. package/src/components/alert-confirm/index.js +26 -0
  12. package/src/components/alert-message/alert-message.vue +63 -0
  13. package/src/components/alert-message/index.js +27 -0
  14. package/src/components/backtop/backtop.vue +61 -0
  15. package/src/components/carousel/carousel.vue +107 -0
  16. package/src/components/collapse/collapse.js +8 -0
  17. package/src/components/dropdown/dropdown.js +10 -0
  18. package/src/components/image-preview/image-preview.vue +261 -0
  19. package/src/components/image-preview/index.js +26 -0
  20. package/src/components/loading/index.js +45 -0
  21. package/src/components/loading/loading-fullscreen.vue +47 -0
  22. package/src/components/loading/loading.vue +47 -0
  23. package/src/components/modal/modal.vue +83 -0
  24. package/src/components/modal-2/counter.js +25 -0
  25. package/src/components/modal-2/modal-2.vue +256 -0
  26. package/src/components/offcanvas/offcanvas.vue +71 -0
  27. package/src/components/pagination/pagination.vue +216 -0
  28. package/src/components/popover/popover.js +10 -0
  29. package/src/components/scrollspy/scrollspy.js +16 -0
  30. package/src/components/table/table-col.vue +61 -0
  31. package/src/components/table/table-keys.js +2 -0
  32. package/src/components/table/table.vue +320 -0
  33. package/src/components/tabs/tab-pane.vue +32 -0
  34. package/src/components/tabs/tabs-keys.js +1 -0
  35. package/src/components/tabs/tabs.vue +240 -0
  36. package/src/components/toast/index.js +29 -0
  37. package/src/components/toast/toast.vue +91 -0
  38. package/src/components/tooltip/tooltip.js +10 -0
  39. package/src/components/tree/tree-keys.js +7 -0
  40. package/src/components/tree/tree-node.vue +144 -0
  41. package/src/components/tree/tree.vue +92 -0
  42. package/src/components/treetable/treetable-col.vue +37 -0
  43. package/src/components/treetable/treetable-keys.js +3 -0
  44. package/src/components/treetable/treetable-node.vue +104 -0
  45. package/src/components/treetable/treetable.vue +114 -0
  46. package/src/components/uploader/file-uploader.vue +67 -0
  47. package/src/components/uploader/image-many-uploader.vue +173 -0
  48. package/src/components/uploader/image-one-uploader.vue +78 -0
  49. package/src/index.js +66 -0
  50. package/src/styles/alert.scss +33 -0
  51. package/src/styles/backtop.scss +7 -0
  52. package/src/styles/image-preview.scss +11 -0
  53. package/src/styles/index.scss +97 -0
  54. package/src/styles/loading.scss +12 -0
  55. package/src/styles/modal-2.scss +8 -0
  56. package/src/styles/uploader.scss +29 -0
  57. package/README.zh-CN.md +0 -126
  58. package/dist/bootstrap-vue.umd.cjs +0 -3
  59. /package/dist/{bootstrap-vue.css → bootstrap-vue-top.css} +0 -0
  60. /package/dist/{bootstrap-vue.js → bootstrap-vue-top.js} +0 -0
@@ -0,0 +1,173 @@
1
+ <template>
2
+ <div class="image-uploader-many">
3
+ <div
4
+ v-for="(imgUrl, index) in imgUrls"
5
+ class="position-relative"
6
+ :style="{ width: width, height: height }"
7
+ :key="imgUrl"
8
+ draggable="false"
9
+ @dragstart="dragstart(imgUrl, $event)"
10
+ @dragenter="dragenter(imgUrl, $event)"
11
+ @dragend="dragend"
12
+ @dragover="dragover"
13
+ >
14
+ <a href="#" class="d-block w-100 h-100" draggable="false" @click.prevent="handlePreview(index)"
15
+ ><img draggable="false" class="d-block border object-fit-cover rounded w-100 h-100" :src="imgUrl"
16
+ /></a>
17
+ <div class="position-absolute top-0 start-0 end-0 z-1 d-flex p-2">
18
+ <button
19
+ v-if="sortable"
20
+ type="button"
21
+ :disabled="disabled"
22
+ class="btn btn-secondary d-none d-lg-block"
23
+ style="
24
+ --bs-btn-padding-x: 0.5rem;
25
+ --bs-btn-padding-y: 0.5rem;
26
+ --bs-btn-line-height: 1;
27
+ --bs-btn-border-radius: 50%;
28
+ cursor: move;
29
+ "
30
+ @mousedown="handleStart"
31
+ @mouseup="handleEnd"
32
+ >
33
+ <bi-arrows-move />
34
+ </button>
35
+ <button
36
+ type="button"
37
+ :disabled="disabled"
38
+ class="btn btn-secondary ms-auto"
39
+ style="
40
+ --bs-btn-padding-x: 0.5rem;
41
+ --bs-btn-padding-y: 0.5rem;
42
+ --bs-btn-line-height: 1;
43
+ --bs-btn-border-radius: 50%;
44
+ "
45
+ @click.stop="handleRemove(index)"
46
+ >
47
+ <bi-trash />
48
+ </button>
49
+ </div>
50
+ </div>
51
+ <button
52
+ type="button"
53
+ :disabled="disabled"
54
+ class="btn btn-image-uploader"
55
+ :style="{ width: width, height: height }"
56
+ @click="openImageDialog"
57
+ >
58
+ <bi-plus-lg class="fs-3" />
59
+ </button>
60
+ <input
61
+ ref="fileRef"
62
+ type="file"
63
+ multiple
64
+ name="file"
65
+ style="display: none"
66
+ accept="image/*"
67
+ @change="handleChange"
68
+ />
69
+ </div>
70
+ <slot v-if="$slots.tip" name="tip"></slot>
71
+ </template>
72
+
73
+ <script setup>
74
+ import { shallowRef } from 'vue';
75
+
76
+ const emit = defineEmits(['file-change', 'file-remove', 'file-preview']);
77
+
78
+ const props = defineProps({
79
+ imgUrls: {
80
+ type: Array,
81
+ default: []
82
+ },
83
+ width: {
84
+ type: String,
85
+ default: '160px'
86
+ },
87
+ height: {
88
+ type: String,
89
+ default: '160px'
90
+ },
91
+ disabled: {
92
+ type: Boolean,
93
+ default: false
94
+ },
95
+ sortable: {
96
+ type: Boolean,
97
+ default: false
98
+ }
99
+ });
100
+
101
+ const fileRef = shallowRef(null);
102
+ function openImageDialog() {
103
+ fileRef.value.click();
104
+ }
105
+
106
+ function handleChange(event) {
107
+ emit('file-change', event.target);
108
+ }
109
+
110
+ function handleRemove(index) {
111
+ emit('file-remove', index);
112
+ }
113
+
114
+ function handlePreview(index) {
115
+ emit('file-preview', index);
116
+ }
117
+
118
+ //拖动排序
119
+ let dragId = null;
120
+ function dragstart(imgUrl, event) {
121
+ //监听dragOption拖动开始
122
+ dragId = imgUrl;
123
+
124
+ let elem = event.currentTarget.querySelector('img');
125
+ elem.classList.add('border-primary');
126
+
127
+ event.dataTransfer.effectAllowd = 'move';
128
+ }
129
+ function dragenter(imgUrl, event) {
130
+ //监听dragId排序拖动的放置
131
+ event.preventDefault();
132
+
133
+ var sourceId = dragId;
134
+ var targetId = imgUrl;
135
+
136
+ if (!sourceId || !targetId) return;
137
+ if (sourceId === targetId) return;
138
+
139
+ var sourceIdIndex = props.imgUrls.findIndex((imgUrl) => imgUrl === sourceId);
140
+ var targetIdIndex = props.imgUrls.findIndex((imgUrl) => imgUrl === targetId);
141
+ var sourceItem = props.imgUrls[sourceIdIndex];
142
+ props.imgUrls.splice(sourceIdIndex, 1);
143
+ props.imgUrls.splice(targetIdIndex, 0, sourceItem);
144
+ }
145
+ function dragend(event) {
146
+ //监听dragId排序拖动的结束
147
+ event.preventDefault();
148
+
149
+ let elem = event.currentTarget.querySelector('img');
150
+ elem.classList.remove('border-primary');
151
+
152
+ dragId = null; //清除dragId
153
+ event.currentTarget.setAttribute('draggable', false);
154
+ }
155
+ function dragover(event) {
156
+ event.preventDefault();
157
+ //拖放视觉效果
158
+ event.dataTransfer.dropEffect = 'move';
159
+ }
160
+
161
+ function handleStart(event) {
162
+ if (event.button !== 0) return;
163
+ const elem = event.currentTarget;
164
+ elem.parentNode.parentNode.setAttribute('draggable', true);
165
+ }
166
+
167
+ function handleEnd(event) {
168
+ if (event.button !== 0) return;
169
+
170
+ const elem = event.currentTarget;
171
+ elem.parentNode.parentNode.setAttribute('draggable', false);
172
+ }
173
+ </script>
@@ -0,0 +1,78 @@
1
+ <template>
2
+ <div class="image-uploader-one">
3
+ <div v-if="imgUrl" class="position-relative" :style="{ width: width, height: height }">
4
+ <a href="#" class="d-block w-100 h-100" @click.prevent="handlePreview"
5
+ ><img class="d-block border object-fit-cover rounded w-100 h-100" :src="imgUrl"
6
+ /></a>
7
+ <div class="position-absolute top-0 end-0 z-1 p-2">
8
+ <button
9
+ type="button"
10
+ :disabled="disabled"
11
+ class="btn btn-secondary"
12
+ style="
13
+ --bs-btn-padding-x: 0.5rem;
14
+ --bs-btn-padding-y: 0.5rem;
15
+ --bs-btn-line-height: 1;
16
+ --bs-btn-border-radius: 50%;
17
+ "
18
+ @click.stop="handleRemove"
19
+ >
20
+ <bi-trash />
21
+ </button>
22
+ </div>
23
+ </div>
24
+ <button
25
+ v-else
26
+ type="button"
27
+ :disabled="disabled"
28
+ class="btn btn-image-uploader"
29
+ :style="{ width: width, height: height }"
30
+ @click="openImageDialog"
31
+ >
32
+ <bi-plus-lg class="fs-3" />
33
+ </button>
34
+ <input ref="fileRef" type="file" name="file" style="display: none" accept="image/*" @change="handleChange" />
35
+ </div>
36
+ <slot v-if="$slots.tip" name="tip"></slot>
37
+ </template>
38
+
39
+ <script setup>
40
+ import { shallowRef } from 'vue';
41
+ const emit = defineEmits(['file-change', 'file-remove', 'file-preview']);
42
+
43
+ const props = defineProps({
44
+ imgUrl: {
45
+ type: String,
46
+ default: null
47
+ },
48
+ width: {
49
+ type: String,
50
+ default: '160px'
51
+ },
52
+ height: {
53
+ type: String,
54
+ default: '160px'
55
+ },
56
+ disabled: {
57
+ type: Boolean,
58
+ default: false
59
+ }
60
+ });
61
+
62
+ const fileRef = shallowRef(null);
63
+ function openImageDialog() {
64
+ fileRef.value.click();
65
+ }
66
+
67
+ function handleChange(event) {
68
+ emit('file-change', event.target);
69
+ }
70
+
71
+ function handleRemove() {
72
+ emit('file-remove');
73
+ }
74
+
75
+ function handlePreview() {
76
+ emit('file-preview');
77
+ }
78
+ </script>
package/src/index.js ADDED
@@ -0,0 +1,66 @@
1
+ import './styles/index.scss';
2
+
3
+ import * as bootstrap from 'bootstrap';
4
+
5
+ import vAlert from './components/alert/alert.js';
6
+ import vDropdown from './components/dropdown/dropdown.js';
7
+ import vTooltip from './components/tooltip/tooltip.js';
8
+ import vPopover from './components/popover/popover.js';
9
+ import vScrollspy from './components/scrollspy/scrollspy.js';
10
+ import vCollapse from './components/collapse/collapse.js';
11
+
12
+ import BvTable from './components/table/table.vue';
13
+ import BvTableCol from './components/table/table-col.vue';
14
+ import BvPagination from './components/pagination/pagination.vue';
15
+ import BvModal from './components/modal/modal.vue';
16
+ import BvModal2 from './components/modal-2/modal-2.vue';
17
+ import BvTree from './components/tree/tree.vue';
18
+ import BvTreetable from './components/treetable/treetable.vue';
19
+ import BvTreetableCol from './components/treetable/treetable-col.vue';
20
+ import BvTabs from './components/tabs/tabs.vue';
21
+ import BvTabPane from './components/tabs/tab-pane.vue';
22
+ import BvAccordion from './components/accordion/accordion.vue';
23
+ import BvAccordionItem from './components/accordion/accordion-item.vue';
24
+ import BvCarousel from './components/carousel/carousel.vue';
25
+ import BvOffcanvas from './components/offcanvas/offcanvas.vue';
26
+ import BvBacktop from './components/backtop/backtop.vue';
27
+ import BvImageOneUploader from './components/uploader/image-one-uploader.vue';
28
+ import BvImageManyUploader from './components/uploader/image-many-uploader.vue';
29
+ import BvFileUploader from './components/uploader/file-uploader.vue';
30
+ import BvLoading from './components/loading/loading.vue';
31
+
32
+ export default {
33
+ install: (app, options) => {
34
+ app.directive('alert', vAlert);
35
+ app.directive('dropdown', vDropdown);
36
+ app.directive('tooltip', vTooltip);
37
+ app.directive('popover', vPopover);
38
+ app.directive('scrollspy', vScrollspy);
39
+ app.directive('collapse', vCollapse);
40
+
41
+ app.component('BvTable', BvTable).component('BvTableCol', BvTableCol);
42
+ app.component('BvPagination', BvPagination);
43
+ app.component('BvModal', BvModal);
44
+ app.component('BvModal2', BvModal2);
45
+ app.component('BvTree', BvTree);
46
+ app.component('BvTreetable', BvTreetable).component('BvTreetableCol', BvTreetableCol);
47
+ app.component('BvTabs', BvTabs).component('BvTabPane', BvTabPane);
48
+ app.component('BvAccordion', BvAccordion).component('BvAccordionItem', BvAccordionItem);
49
+ app.component('BvCarousel', BvCarousel);
50
+ app.component('BvOffcanvas', BvOffcanvas);
51
+ app.component('BvBacktop', BvBacktop);
52
+ app.component('BvImageOneUploader', BvImageOneUploader);
53
+ app.component('BvImageManyUploader', BvImageManyUploader);
54
+ app.component('BvFileUploader', BvFileUploader);
55
+ app.component('BvLoading', BvLoading);
56
+ }
57
+ };
58
+
59
+ import alertBox from './components/alert-box/index.js';
60
+ import alertConfirm from './components/alert-confirm/index.js';
61
+ import alertMessage from './components/alert-message/index.js';
62
+ import imagePreview from './components/image-preview/index.js';
63
+ import LoadingFullscreen from './components/loading/index.js';
64
+ import toast from './components/toast/index.js';
65
+
66
+ export { bootstrap, alertBox, alertConfirm, alertMessage, imagePreview, LoadingFullscreen, toast };
@@ -0,0 +1,33 @@
1
+
2
+ .alert-message {
3
+ z-index: $zindex-alert;
4
+ position: fixed;
5
+ width: fit-content;
6
+ max-width: 75%;
7
+ top: 0.5rem;
8
+ left: 0;
9
+ right: 0;
10
+ margin: 0 auto;
11
+ }
12
+
13
+ .alert-box {
14
+ z-index: $zindex-alert;
15
+ position: fixed;
16
+ top: 0;
17
+ left: 0;
18
+ width: 100vw;
19
+ height: 100%;
20
+ overflow: hidden;
21
+ background-color: rgba(0, 0, 0, .5);
22
+ }
23
+
24
+ .alert-confirm {
25
+ z-index: $zindex-alert;
26
+ position: fixed;
27
+ top: 0;
28
+ left: 0;
29
+ width: 100vw;
30
+ height: 100%;
31
+ overflow: hidden;
32
+ background-color: rgba(0, 0, 0, .5);
33
+ }
@@ -0,0 +1,7 @@
1
+
2
+ .backtop {
3
+ z-index: $zindex-backtop;
4
+ position: fixed;
5
+ bottom: 36px;
6
+ right: 36px;
7
+ }
@@ -0,0 +1,11 @@
1
+
2
+ .image-preview {
3
+ z-index: $zindex-image-preview;
4
+ position: fixed;
5
+ top: 0;
6
+ left: 0;
7
+ width: 100vw;
8
+ height: 100%;
9
+ overflow: hidden;
10
+ background-color: rgba(255, 255, 255, 0.5);
11
+ }
@@ -0,0 +1,97 @@
1
+ // 覆盖变量
2
+ $enable-validation-icons: false;
3
+ $pagination-padding-y-lg: 0.5rem;
4
+ $modal-footer-margin-between: 1rem;
5
+
6
+ // 自定义变量
7
+ $zindex-backtop: 990;
8
+ $zindex-image-preview: 1082;
9
+ $zindex-loading-fullscreen: 1083;
10
+ $zindex-alert: 1085;
11
+
12
+ @import 'bootstrap/scss/mixins/banner';
13
+ @include bsBanner('');
14
+
15
+ // Configuration
16
+ @import 'bootstrap/scss/functions';
17
+ @import 'bootstrap/scss/variables';
18
+ @import 'bootstrap/scss/variables-dark';
19
+ @import 'bootstrap/scss/maps';
20
+ @import 'bootstrap/scss/mixins';
21
+ @import 'bootstrap/scss/utilities';
22
+
23
+ // Layout & components
24
+ @import 'bootstrap/scss/root';
25
+ @import 'bootstrap/scss/reboot';
26
+ @import 'bootstrap/scss/type';
27
+ @import 'bootstrap/scss/images';
28
+ @import 'bootstrap/scss/containers';
29
+ @import 'bootstrap/scss/grid';
30
+ @import 'bootstrap/scss/tables';
31
+ @import 'bootstrap/scss/forms';
32
+ @import 'bootstrap/scss/buttons';
33
+ @import 'bootstrap/scss/transitions';
34
+ @import 'bootstrap/scss/dropdown';
35
+ @import 'bootstrap/scss/button-group';
36
+ @import 'bootstrap/scss/nav';
37
+ @import 'bootstrap/scss/navbar';
38
+ @import 'bootstrap/scss/card';
39
+ @import 'bootstrap/scss/accordion';
40
+ @import 'bootstrap/scss/breadcrumb';
41
+ @import 'bootstrap/scss/pagination';
42
+ @import 'bootstrap/scss/badge';
43
+ @import 'bootstrap/scss/alert';
44
+ @import 'bootstrap/scss/progress';
45
+ @import 'bootstrap/scss/list-group';
46
+ @import 'bootstrap/scss/close';
47
+ @import 'bootstrap/scss/toasts';
48
+ @import 'bootstrap/scss/modal';
49
+ @import 'bootstrap/scss/tooltip';
50
+ @import 'bootstrap/scss/popover';
51
+ @import 'bootstrap/scss/carousel';
52
+ @import 'bootstrap/scss/spinners';
53
+ @import 'bootstrap/scss/offcanvas';
54
+ @import 'bootstrap/scss/placeholders';
55
+
56
+ @import 'modal-2.scss';
57
+ @import 'alert.scss';
58
+ @import 'loading.scss';
59
+ @import 'backtop.scss';
60
+ @import 'uploader.scss';
61
+ @import 'image-preview.scss';
62
+
63
+ // Helpers
64
+ @import 'bootstrap/scss/helpers';
65
+
66
+ // Utilities
67
+ @import 'bootstrap/scss/utilities/api';
68
+
69
+ .bi {
70
+ width: 1em;
71
+ height: 1em;
72
+ line-height: 1;
73
+ display: inline-block;
74
+ vertical-align: -0.125em;
75
+ fill: currentColor;
76
+ }
77
+
78
+ .fadeIn-enter-active,
79
+ .fadeIn-leave-active {
80
+ transition: opacity 0.3s ease;
81
+ }
82
+ .fadeIn-enter-from,
83
+ .fadeIn-leave-to {
84
+ opacity: 0;
85
+ }
86
+
87
+ .fadeInDown-enter-active,
88
+ .fadeInDown-leave-active {
89
+ transition:
90
+ opacity 0.3s,
91
+ transform 0.3s;
92
+ }
93
+ .fadeInDown-enter-from,
94
+ .fadeInDown-leave-to {
95
+ opacity: 0;
96
+ transform: translateY(-60px);
97
+ }
@@ -0,0 +1,12 @@
1
+
2
+
3
+ .loading-fullscreen {
4
+ z-index: $zindex-loading-fullscreen;
5
+ position: fixed;
6
+ top: 0;
7
+ left: 0;
8
+ width: 100vw;
9
+ height: 100%;
10
+ overflow: hidden;
11
+ background-color: rgba(255, 255, 255, 0.5);
12
+ }
@@ -0,0 +1,8 @@
1
+ .modal-2 {
2
+ display: block;
3
+ width: 100vw;
4
+ height: 100%;
5
+ overflow-x: hidden;
6
+ overflow-y: auto;
7
+ background-color: rgba($modal-backdrop-bg, $modal-backdrop-opacity);
8
+ }
@@ -0,0 +1,29 @@
1
+
2
+
3
+ .image-uploader-one img:hover {
4
+ opacity: .75;
5
+ }
6
+
7
+ .image-uploader-many {
8
+ display: flex;
9
+ flex-wrap: wrap;
10
+ gap: .5rem;
11
+ }
12
+
13
+ .image-uploader-many img:hover {
14
+ opacity: .75;
15
+ }
16
+
17
+ .btn-image-uploader {
18
+ --bs-btn-padding-x: 0;
19
+ --bs-btn-padding-y: 0;
20
+ --bs-btn-border-radius:var(--bs-border-radius);
21
+ --bs-btn-border-color:var(--bs-border-color);
22
+ --bs-btn-line-height:1;
23
+ display: block;
24
+ border-style: dashed;
25
+ }
26
+
27
+ .btn-image-uploader:hover {
28
+ border-color:var(--bs-primary);
29
+ }
package/README.zh-CN.md DELETED
@@ -1,126 +0,0 @@
1
- # bootstrap-vue-top
2
-
3
- 基于 Bootstrap 5.3.8 & Vue 3.5.x 的前端组件库
4
-
5
- ## 简介
6
-
7
- 这是一个现代化的前端框架解决方案,将 Bootstrap 5.3.8 与 Vue 3.5.x 完美结合,充分利用双方的优势:Bootstrap 5 提供了强大的 UI 组件库和响应式布局系统,而 Vue 3 则带来了高效的数据驱动响应式渲染和 Composition API。
8
-
9
- 框架严格遵循"样式用 Bootstrap,行为用 Vue"的架构范式,完全继承 Bootstrap 的原子化工具类(间距、字体、颜色、Flex/Grid),开发者无需学习新的 CSS 类名,可直接使用原生类名如 `d-flex`、`text-primary`、`mb-3` 等来控制外观。
10
-
11
- Bootstrap 官方文档中描述的所有样式类(如表格条纹、卡片分组、栅格偏移等)均可直接在 Vue 项目中使用,降低了团队的学习和迁移成本。
12
-
13
- ## 特性
14
-
15
- - **Vue 3 + Composition API**: 使用 Vue 3 最新特性开发
16
- - **Bootstrap 5 样式**: 完全继承 Bootstrap 5 的全部样式类
17
- - **组件丰富**: 提供 20+ 常用组件
18
- - **文档完善**: 配套完整的中文文档网站
19
-
20
-
21
- ## 安装
22
-
23
- ```bash
24
- npm install bootstrap-vue-top
25
- ```
26
-
27
-
28
- ## 快速开始
29
-
30
- **main.js**
31
- ```javascript
32
- import { createApp } from 'vue'
33
- import App from './App.vue'
34
-
35
- // 引入样式(已包括bootstrap 5 样式,切记不要再次引入。)
36
- import 'bootstrap-vue-top/style.css'
37
- // 引入Vue组件(已打包bootstrap 5 JS 组件,切记不要再次引入。)
38
- import BootstrapVueTop from 'bootstrap-vue-top'
39
-
40
- const app = createApp(App)
41
- app.use(BootstrapVueTop)
42
- app.mount('#app')
43
- ```
44
-
45
- **App.vue**
46
- ```html
47
- <template>
48
- <div class="container p-3">
49
- <h1 class="text-primary text-center">Hello</h1>
50
-
51
- <h4 class="mt-4">Example 1 (vue 组件)</h4>
52
- <bv-table :data="tableData" table-class="table-bordered">
53
- <bv-table-col header="Code" field="code" />
54
- <bv-table-col header="Name" field="name" />
55
- <bv-table-col header="Address" field="address" />
56
- </bv-table>
57
-
58
- <h4 class="mt-4">Example 2 (Bootstrap 组件)</h4>
59
- <div>
60
- <button ref="popoverRef" type="button" class="btn btn-primary" data-bs-toggle="popover"
61
- data-bs-title="Popover title"
62
- data-bs-content="And here’s some amazing content. It’s very engaging. Right?">Click to toggle
63
- popover</button>
64
- </div>
65
- </div>
66
- </template>
67
-
68
- <script setup>
69
- import { ref, onMounted, onBeforeUnmount } from 'vue'
70
-
71
- const tableData = ref([
72
- { code: 1001, name: 'Kris1', address: 'Honghu City, Hubei Province, China' },
73
- { code: 1002, name: 'Kris2', address: 'Honghu City, Hubei Province, China' },
74
- { code: 1003, name: 'Kris3', address: 'Honghu City, Hubei Province, China' }
75
- ])
76
-
77
- // Bootstrap 组件
78
- import { bootstrap } from 'bootstrap-vue-top'
79
- const popoverRef = ref(null)
80
- onMounted(() => {
81
- // 实例化 Bootstrap 组件
82
- new bootstrap.Popover(popoverRef.value, {
83
- container: 'body'
84
- })
85
- })
86
- onBeforeUnmount(() => {
87
- // 销毁 Bootstrap 组件
88
- bootstrap.Popover.getInstance(popoverRef.value).dispose();
89
- })
90
- </script>
91
- ```
92
-
93
-
94
- ## 开发
95
-
96
- ```bash
97
- # 安装依赖
98
- npm install
99
-
100
- # 启动开发服务器
101
- npm run dev
102
-
103
- # 构建生产版本
104
- npm run build
105
- ```
106
-
107
- ### 开发文档网站
108
-
109
- ```bash
110
- cd website
111
- npm install
112
- npm run dev
113
- ```
114
-
115
-
116
- ## 浏览器支持
117
-
118
- - Chrome >= 84
119
- - Firefox >= 63
120
- - iOS >= 14.5
121
- - Safari >= 14.1
122
-
123
-
124
- ## 协议
125
-
126
- MIT License