bootstrap-vue-top 1.0.7 → 1.0.9

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 (61) hide show
  1. package/.browserslistrc +12 -0
  2. package/README.md +4 -6
  3. package/package.json +17 -12
  4. package/postcss.config.js +6 -0
  5. package/src/components/accordion/accordion-item.vue +27 -0
  6. package/src/components/accordion/accordion-keys.js +1 -0
  7. package/src/components/accordion/accordion.vue +84 -0
  8. package/src/components/alert/alert.js +10 -0
  9. package/src/components/alert-box/alert-box.vue +73 -0
  10. package/src/components/alert-box/index.js +25 -0
  11. package/src/components/alert-confirm/alert-confirm.vue +80 -0
  12. package/src/components/alert-confirm/index.js +26 -0
  13. package/src/components/alert-message/alert-message.vue +63 -0
  14. package/src/components/alert-message/index.js +27 -0
  15. package/src/components/backtop/backtop.vue +61 -0
  16. package/src/components/carousel/carousel.vue +107 -0
  17. package/src/components/collapse/collapse.js +8 -0
  18. package/src/components/dropdown/dropdown.js +11 -0
  19. package/src/components/image-preview/image-preview.vue +261 -0
  20. package/src/components/image-preview/index.js +26 -0
  21. package/src/components/loading/index.js +45 -0
  22. package/src/components/loading/loading-fullscreen.vue +47 -0
  23. package/src/components/loading/loading.vue +47 -0
  24. package/src/components/modal/modal.vue +83 -0
  25. package/src/components/modal-2/counter.js +25 -0
  26. package/src/components/modal-2/modal-2.vue +256 -0
  27. package/src/components/offcanvas/offcanvas.vue +71 -0
  28. package/src/components/pagination/pagination.vue +216 -0
  29. package/src/components/popover/popover.js +10 -0
  30. package/src/components/scrollspy/scrollspy.js +16 -0
  31. package/src/components/table/table-col.vue +61 -0
  32. package/src/components/table/table-keys.js +2 -0
  33. package/src/components/table/table.vue +320 -0
  34. package/src/components/tabs/tab-pane.vue +32 -0
  35. package/src/components/tabs/tabs-keys.js +1 -0
  36. package/src/components/tabs/tabs.vue +240 -0
  37. package/src/components/toast/index.js +29 -0
  38. package/src/components/toast/toast.vue +91 -0
  39. package/src/components/tooltip/tooltip.js +10 -0
  40. package/src/components/tree/tree-keys.js +7 -0
  41. package/src/components/tree/tree-node.vue +144 -0
  42. package/src/components/tree/tree.vue +92 -0
  43. package/src/components/treetable/treetable-col.vue +37 -0
  44. package/src/components/treetable/treetable-keys.js +3 -0
  45. package/src/components/treetable/treetable-node.vue +104 -0
  46. package/src/components/treetable/treetable.vue +114 -0
  47. package/src/components/uploader/file-uploader.vue +67 -0
  48. package/src/components/uploader/image-many-uploader.vue +173 -0
  49. package/src/components/uploader/image-one-uploader.vue +78 -0
  50. package/src/index.js +64 -0
  51. package/src/styles/alert.scss +33 -0
  52. package/src/styles/backtop.scss +7 -0
  53. package/src/styles/image-preview.scss +11 -0
  54. package/src/styles/index.scss +97 -0
  55. package/src/styles/loading.scss +12 -0
  56. package/src/styles/modal-2.scss +8 -0
  57. package/src/styles/uploader.scss +29 -0
  58. package/vite.config.js +58 -0
  59. package/dist/bootstrap-vue.css +0 -2
  60. package/dist/bootstrap-vue.js +0 -7310
  61. package/dist/bootstrap-vue.umd.cjs +0 -1
@@ -0,0 +1,12 @@
1
+ # https://github.com/browserslist/browserslist#readme
2
+
3
+ >= 0.5%
4
+ last 2 major versions
5
+ not dead
6
+ Chrome >= 84
7
+ Firefox >= 63
8
+ Firefox ESR
9
+ iOS >= 14.5
10
+ Safari >= 14.1
11
+ not Explorer <= 11
12
+ not kaios <= 2.5 # fix floating label issues in Firefox (see https://github.com/postcss/autoprefixer/issues/1533)
package/README.md CHANGED
@@ -1,11 +1,9 @@
1
1
  # bootstrap-vue-top
2
- 基于 Bootstrap 5 & Vue 3 的前端框架
2
+ 基于 Bootstrap 5.3.8 & Vue 3.5.x 的前端框架
3
3
 
4
4
  ## 简介
5
- 框架完美融合了 Bootstrap 强大的样式体系与 Vue 的响应式数据驱动能力,为开发者提供了一套高度灵活、高效、稳健,适配不同设备尺寸的企业级 UI 解决方案。
5
+ 这是一个融合了 Bootstrap 5.3.8 和 Vue 3.5.x 的现代化前端框架解决方案,充分发挥了两者的优势:Bootstrap 5 提供强大的 UI 组件库和响应式布局系统,Vue 3 则带来了高效的响应式数据驱动和组合式 API。
6
6
 
7
- 框架严格遵循“样式归 Bootstrap,行为归 Vue”的架构范式。完全继承 Bootstrap 的原子化工具类(间距、排版、颜色、Flex/Grid 栅格),开发者无需学习新的 CSS类名,直接使用 d-flex、text-primary、mb-3 等原生类名控制外观。
7
+ 严格遵循“样式归 Bootstrap,行为归 Vue”的架构范式。完全继承 Bootstrap 的原子化工具类(间距、排版、颜色、Flex/Grid 栅格),开发者无需学习新的 CSS类名,直接使用 d-flex、text-primary、mb-3 等原生类名控制外观。
8
8
 
9
- 框架将 Bootstrap 的纯交互组件(弹窗、轮播、工具提示等)转化为 Vue 的声明式组件。
10
-
11
- 框架只接管了 JavaScript 交互部分,CSS 层面完全透明。这意味着:所有 Bootstrap 官方文档中关于样式类的说明(如表格条纹、卡片分组、网格偏移)在 Vue项目中直接适用,降低了团队的学习与迁移成本。
9
+ 所有 Bootstrap 官方文档中关于样式类的说明(如表格条纹、卡片分组、网格偏移)在 Vue项目中直接适用,降低了团队的学习与迁移成本。
package/package.json CHANGED
@@ -1,14 +1,19 @@
1
1
  {
2
2
  "name": "bootstrap-vue-top",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "homepage": "https://bootstrap-vue.top",
5
5
  "private": false,
6
6
  "type": "module",
7
- "description": "bootstrap-vue-top 是一个基于 Bootstrap 5 & Vue 3 的前端框架。",
7
+ "description": "bootstrap-vue-top 是一个基于 Bootstrap & Vue 的前端框架。",
8
8
  "files": [
9
9
  "dist",
10
+ "src",
11
+ ".browserslistrc",
12
+ "package.json",
13
+ "postcss.config.js",
10
14
  "README.md",
11
- "LICENSE"
15
+ "LICENSE",
16
+ "vite.config.js"
12
17
  ],
13
18
  "main": "./dist/bootstrap-vue.umd.cjs",
14
19
  "module": "./dist/bootstrap-vue.js",
@@ -29,25 +34,25 @@
29
34
  "dependencies": {
30
35
  "@popperjs/core": "^2.11.8",
31
36
  "bootstrap": "^5.3.8",
32
- "focus-trap": "^8.2.2",
37
+ "focus-trap": "^8.2.3",
33
38
  "lodash-es": "^4.18.1"
34
39
  },
35
40
  "devDependencies": {
36
41
  "@iconify-json/bi": "^1.2.7",
37
- "@vitejs/plugin-vue": "^6.0.8",
38
- "autoprefixer": "^10.5.4",
39
- "prettier": "^3.9.6",
40
- "sass": "^1.103.1",
42
+ "@vitejs/plugin-vue": "^6.0.10",
43
+ "autoprefixer": "^10.6.1",
44
+ "prettier": "^3.9.10",
45
+ "sass": "^1.105.2",
41
46
  "unplugin-icons": "^22.5.0",
42
47
  "unplugin-vue-components": "^30.0.0",
43
- "vite": "^8.2.2",
44
- "vue": "^3.5.41"
48
+ "vite": "^8.3.4",
49
+ "vue": "^3.5.44"
45
50
  },
46
51
  "keywords": [
47
52
  "boostrap 5.3.8",
48
- "vue 3.5.41",
53
+ "vue 3.5.x",
49
54
  "ES6",
50
- "ui library"
55
+ "javascript"
51
56
  ],
52
57
  "author": "kris.liu",
53
58
  "license": "MIT"
@@ -0,0 +1,6 @@
1
+ // postcss.config.js
2
+ export default {
3
+ plugins: {
4
+ autoprefixer: {} // 它会自动读取 .browserslistrc
5
+ }
6
+ }
@@ -0,0 +1,27 @@
1
+ <template></template>
2
+ <script setup>
3
+ import { inject, onMounted, onBeforeUnmount, useId } from 'vue';
4
+ import { items_injection_key } from './accordion-keys.js';
5
+
6
+ const props = defineProps({
7
+ header: {
8
+ type: String,
9
+ default: 'Header'
10
+ }
11
+ });
12
+
13
+ const items = inject(items_injection_key);
14
+ const keyId = useId();
15
+ onMounted(() => {
16
+ const item = {
17
+ keyId: keyId,
18
+ header: props.header
19
+ };
20
+ items.push(item);
21
+ });
22
+
23
+ onBeforeUnmount(() => {
24
+ const index = items.findIndex((item) => item.keyId === keyId);
25
+ items.splice(index, 1);
26
+ });
27
+ </script>
@@ -0,0 +1 @@
1
+ export const items_injection_key = Symbol();
@@ -0,0 +1,84 @@
1
+ <template>
2
+ <div :id="id" class="accordion" :class="accordionClass">
3
+ <slot></slot>
4
+ <template v-if="ready">
5
+ <div v-for="(item, index) in items" class="accordion-item" :key="item.keyId">
6
+ <h2 class="accordion-header">
7
+ <button
8
+ type="button"
9
+ class="accordion-button"
10
+ :class="{ collapsed: initActiveIndex !== index }"
11
+ data-bs-toggle="collapse"
12
+ :data-bs-target="`#${item.keyId}`"
13
+ :aria-expanded="initActiveIndex === index"
14
+ :aria-controls="`#${item.keyId}`"
15
+ >
16
+ {{ item.header }}
17
+ </button>
18
+ </h2>
19
+ <div
20
+ :id="item.keyId"
21
+ class="accordion-collapse collapse"
22
+ :class="{ show: initActiveIndex === index }"
23
+ :data-bs-parent="always ? null : `#${id}`"
24
+ >
25
+ <div class="accordion-body">
26
+ <component :is="item.body" />
27
+ </div>
28
+ </div>
29
+ </div>
30
+ </template>
31
+ </div>
32
+ </template>
33
+
34
+ <script setup>
35
+ import { useSlots, ref, provide, onMounted, useId } from 'vue';
36
+ import { items_injection_key } from './accordion-keys.js';
37
+ import Collapse from 'bootstrap/js/dist/collapse';
38
+
39
+ const ready = ref(false);
40
+ const id = useId();
41
+ const props = defineProps({
42
+ accordionClass: {
43
+ type: String,
44
+ default: null
45
+ },
46
+ always: {
47
+ type: Boolean,
48
+ default: false
49
+ },
50
+ initActiveIndex: {
51
+ type: Number,
52
+ default: null
53
+ }
54
+ });
55
+
56
+ const items = [];
57
+ provide(items_injection_key, items);
58
+
59
+ onMounted(() => {
60
+ _initItems();
61
+
62
+ ready.value = true;
63
+ });
64
+
65
+ function _initItems() {
66
+ const slots = useSlots();
67
+ const vNodes = slots.default();
68
+
69
+ const itemVNodes = [];
70
+ for (const vNode of vNodes) {
71
+ if (vNode.type.__name === 'accordion-item') {
72
+ itemVNodes.push(vNode);
73
+ }
74
+ }
75
+
76
+ for (let i = 0; i < items.length; i++) {
77
+ if (itemVNodes[i].children !== null && itemVNodes[i].children.default !== 'undefined') {
78
+ items[i].body = itemVNodes[i].children.default;
79
+ } else {
80
+ items[i].body = null;
81
+ }
82
+ }
83
+ }
84
+ </script>
@@ -0,0 +1,10 @@
1
+ import Alert from 'bootstrap/js/dist/alert';
2
+
3
+ export default {
4
+ mounted(el) {
5
+ new Alert(el);
6
+ },
7
+ beforeUnmount(el) {
8
+ Alert.getInstance(el).dispose();
9
+ }
10
+ };
@@ -0,0 +1,73 @@
1
+ <template>
2
+ <Transition name="fadeIn" @after-leave="$emit('destroy')">
3
+ <div
4
+ v-show="visible"
5
+ ref="elementRef"
6
+ tabindex="-1"
7
+ class="alert-box d-flex justify-content-center align-items-start"
8
+ role="alert"
9
+ >
10
+ <div class="shadow rounded bg-body p-3 col-10 col-sm-9 col-md-6 col-lg-4 col-xl-3" style="margin-top: 25vh">
11
+ <div class="d-flex justify-content-center align-items-center">
12
+ <div class="me-2">
13
+ <BiExclamationCircle class="text-danger fs-5" />
14
+ </div>
15
+ <div class="fs-5 fw-bolder">{{ message }}</div>
16
+ </div>
17
+ <hr />
18
+ <div class="text-center">
19
+ <button type="button" class="btn btn-primary" @click="confirm">确定</button>
20
+ </div>
21
+ </div>
22
+ </div>
23
+ </Transition>
24
+ </template>
25
+
26
+ <script setup>
27
+ import { onMounted, onBeforeUnmount, ref, shallowRef, nextTick } from 'vue';
28
+ import { createFocusTrap } from 'focus-trap';
29
+
30
+ const elementRef = shallowRef(null);
31
+ let focusTrapInstance = null;
32
+
33
+ const props = defineProps({
34
+ message: {
35
+ type: String,
36
+ default: 'Alert Box'
37
+ }
38
+ });
39
+
40
+ const visible = ref(false);
41
+
42
+ onMounted(() => {
43
+ if (document.body.scrollHeight > window.innerHeight) {
44
+ document.body.style.cssText = `overflow: hidden; padding-right: ${window.innerWidth - document.body.clientWidth}px;`;
45
+ }
46
+ visible.value = true;
47
+
48
+ nextTick(() => {
49
+ //焦点陷阱
50
+ if (elementRef.value !== null) {
51
+ focusTrapInstance = createFocusTrap(elementRef.value, {
52
+ initialFocus: false
53
+ });
54
+ focusTrapInstance.activate();
55
+ }
56
+ });
57
+ });
58
+
59
+ onBeforeUnmount(() => {
60
+ if (document.body.scrollHeight > window.innerHeight) {
61
+ document.body.style = null;
62
+ }
63
+
64
+ //停止焦点陷阱
65
+ if (focusTrapInstance !== null) {
66
+ focusTrapInstance.deactivate();
67
+ }
68
+ });
69
+
70
+ function confirm() {
71
+ visible.value = false;
72
+ }
73
+ </script>
@@ -0,0 +1,25 @@
1
+ import { createVNode, render } from 'vue';
2
+ import AlertBox from './alert-box.vue';
3
+
4
+ let container = null;
5
+ const alertBox = function (data) {
6
+ if (container) {
7
+ render(null, container);
8
+ container = null;
9
+ }
10
+
11
+ container = document.createElement('div');
12
+
13
+ const vnode = createVNode(AlertBox, {
14
+ message: data.message,
15
+ onDestroy: () => {
16
+ render(null, container);
17
+ }
18
+ });
19
+
20
+ render(vnode, container);
21
+
22
+ document.body.appendChild(container.firstElementChild);
23
+ };
24
+
25
+ export default alertBox;
@@ -0,0 +1,80 @@
1
+ <template>
2
+ <Transition name="fadeIn" @after-leave="$emit('destroy')">
3
+ <div
4
+ ref="elementRef"
5
+ v-show="visible"
6
+ class="alert-confirm d-flex justify-content-center align-items-start"
7
+ tabindex="-1"
8
+ role="alert"
9
+ >
10
+ <div class="shadow rounded bg-body p-3 col-10 col-sm-9 col-md-6 col-lg-4 col-xl-3" style="margin-top: 25vh">
11
+ <div class="d-flex justify-content-center align-items-center">
12
+ <div class="me-2"><BiExclamationCircle class="text-warning fs-5" /></div>
13
+ <div class="fs-5 fw-bolder">{{ message }}</div>
14
+ </div>
15
+ <hr />
16
+ <div class="text-center">
17
+ <button type="button" class="btn btn-secondary me-3" @click="cancel">取消</button>
18
+ <button type="button" class="btn btn-primary" @click="confirm">确定</button>
19
+ </div>
20
+ </div>
21
+ </div>
22
+ </Transition>
23
+ </template>
24
+
25
+ <script setup>
26
+ import { onMounted, onBeforeUnmount, ref, shallowRef, nextTick } from 'vue';
27
+ import { createFocusTrap } from 'focus-trap';
28
+
29
+ const elementRef = shallowRef(null);
30
+ let focusTrapInstance = null;
31
+
32
+ const props = defineProps({
33
+ message: {
34
+ type: String,
35
+ required: true
36
+ },
37
+ callback: {
38
+ type: Function,
39
+ required: true
40
+ }
41
+ });
42
+
43
+ const visible = ref(false);
44
+ onMounted(() => {
45
+ if (document.body.scrollHeight > window.innerHeight) {
46
+ document.body.style.cssText = `overflow: hidden; padding-right: ${window.innerWidth - document.body.clientWidth}px;`;
47
+ }
48
+ visible.value = true;
49
+
50
+ nextTick(() => {
51
+ //焦点陷阱
52
+ if (elementRef.value !== null) {
53
+ focusTrapInstance = createFocusTrap(elementRef.value, {
54
+ initialFocus: false
55
+ });
56
+ focusTrapInstance.activate();
57
+ }
58
+ });
59
+ });
60
+
61
+ onBeforeUnmount(() => {
62
+ if (document.body.scrollHeight > window.innerHeight) {
63
+ document.body.style = null;
64
+ }
65
+
66
+ //停止焦点陷阱
67
+ if (focusTrapInstance !== null) {
68
+ focusTrapInstance.deactivate();
69
+ }
70
+ });
71
+
72
+ function confirm() {
73
+ visible.value = false;
74
+ props.callback();
75
+ }
76
+
77
+ function cancel() {
78
+ visible.value = false;
79
+ }
80
+ </script>
@@ -0,0 +1,26 @@
1
+ import { createVNode, render } from 'vue';
2
+ import AlertConfirm from './alert-confirm.vue';
3
+
4
+ let container = null;
5
+ const alertConfirm = function (data) {
6
+ if (container) {
7
+ render(null, container);
8
+ container = null;
9
+ }
10
+
11
+ container = document.createElement('div');
12
+
13
+ const vnode = createVNode(AlertConfirm, {
14
+ message: data.message,
15
+ callback: data.confirm,
16
+ onDestroy: () => {
17
+ render(null, container);
18
+ }
19
+ });
20
+
21
+ render(vnode, container);
22
+
23
+ document.body.appendChild(container.firstElementChild);
24
+ };
25
+
26
+ export default alertConfirm;
@@ -0,0 +1,63 @@
1
+ <template>
2
+ <Transition name="fadeInDown" @after-leave="$emit('destroy')">
3
+ <div v-show="visible" class="alert-message" @mouseenter="clearTimer" @mouseleave="startTimer" role="alert">
4
+ <div class="d-flex align-items-center rounded px-3 py-2" :class="className">
5
+ <div class="me-2">
6
+ <BiCheckCircle v-if="type === 'success'" />
7
+ <BiXCircle v-else-if="type === 'danger'" />
8
+ <BiExclamationCircle v-else-if="type === 'warning'" />
9
+ <BiInfoCircle v-else />
10
+ </div>
11
+ <div>{{ message }}</div>
12
+ </div>
13
+ </div>
14
+ </Transition>
15
+ </template>
16
+
17
+ <script setup>
18
+ import { computed, onMounted, ref } from 'vue';
19
+
20
+ const props = defineProps({
21
+ type: {
22
+ type: String,
23
+ default: 'info',
24
+ validator(value) {
25
+ return ['primary', 'secondary', 'success', 'danger', 'warning', 'info', 'light', 'dark'].includes(value);
26
+ }
27
+ },
28
+ message: {
29
+ type: String,
30
+ default: 'Alert Message'
31
+ },
32
+ duration: {
33
+ type: Number,
34
+ default: 3000
35
+ }
36
+ });
37
+
38
+ const visible = ref(false);
39
+
40
+ const className = computed(() => {
41
+ return `text-bg-${props.type}`;
42
+ });
43
+
44
+ onMounted(() => {
45
+ startTimer();
46
+ visible.value = true;
47
+ });
48
+
49
+ function close() {
50
+ visible.value = false;
51
+ }
52
+
53
+ let timer = null;
54
+ function clearTimer() {
55
+ clearTimeout(timer);
56
+ }
57
+
58
+ function startTimer() {
59
+ timer = setTimeout(() => {
60
+ close();
61
+ }, props.duration);
62
+ }
63
+ </script>
@@ -0,0 +1,27 @@
1
+ import { createVNode, render } from 'vue';
2
+ import AlertMessage from './alert-message.vue';
3
+
4
+ let container = null;
5
+ const alertMessage = function (data) {
6
+ if (container !== null) {
7
+ render(null, container);
8
+ container = null;
9
+ }
10
+
11
+ container = document.createElement('div');
12
+
13
+ const vnode = createVNode(AlertMessage, {
14
+ type: data.type,
15
+ message: data.message,
16
+ duration: data.duration,
17
+ onDestroy: () => {
18
+ render(null, container);
19
+ }
20
+ });
21
+
22
+ render(vnode, container);
23
+
24
+ document.body.appendChild(container.firstElementChild);
25
+ };
26
+
27
+ export default alertMessage;
@@ -0,0 +1,61 @@
1
+ <template>
2
+ <Teleport to="body">
3
+ <transition name="fadeIn">
4
+ <a v-if="visible" href="#" role="button" class="backtop" :class="backtopClass" @click.prevent="handleClick">
5
+ <BiArrowUpCircleFill />
6
+ </a>
7
+ </transition>
8
+ </Teleport>
9
+ </template>
10
+
11
+ <script setup>
12
+ import { ref, onMounted, onBeforeUnmount, computed } from 'vue';
13
+
14
+ const visible = ref(false);
15
+
16
+ const props = defineProps({
17
+ color: {
18
+ type: String,
19
+ default: 'primary',
20
+ validator(value) {
21
+ return ['primary', 'secondary', 'success', 'danger', 'warning', 'info', 'light', 'dark'].includes(value);
22
+ }
23
+ },
24
+ size: {
25
+ type: String,
26
+ default: 'md',
27
+ validator(value) {
28
+ return ['sm', 'md', 'lg'].includes(value);
29
+ }
30
+ }
31
+ });
32
+
33
+ const backtopClass = computed(() => {
34
+ const classList = [`link-${props.color}`];
35
+ if (props.size === 'md') {
36
+ classList.push('display-4');
37
+ } else if (props.size === 'sm') {
38
+ classList.push('display-6');
39
+ } else if (props.size === 'lg') {
40
+ classList.push('display-2');
41
+ }
42
+
43
+ return classList;
44
+ });
45
+
46
+ onMounted(() => {
47
+ document.addEventListener('scroll', handleScroll);
48
+ });
49
+
50
+ onBeforeUnmount(() => {
51
+ document.removeEventListener('scroll', handleScroll);
52
+ });
53
+
54
+ function handleScroll() {
55
+ visible.value = document.documentElement.scrollTop >= 200;
56
+ }
57
+
58
+ function handleClick() {
59
+ document.documentElement.scrollTo({ top: 0 });
60
+ }
61
+ </script>
@@ -0,0 +1,107 @@
1
+ <template>
2
+ <div :id="id" class="carousel slide" :class="carouselClass">
3
+ <div v-if="indicator" class="carousel-indicators">
4
+ <template v-for="(item, index) in items" :key="index">
5
+ <button
6
+ type="button"
7
+ :data-bs-target="`#${id}`"
8
+ :data-bs-slide-to="index"
9
+ :class="{ active: index === 0 }"
10
+ :aria-current="index === 0"
11
+ :aria-label="item.title"
12
+ ></button>
13
+ </template>
14
+ </div>
15
+ <div class="carousel-inner">
16
+ <template v-for="(item, index) in items" :key="index">
17
+ <div class="carousel-item" :class="{ active: index === 0 }">
18
+ <img :src="item.image" class="d-block w-100" />
19
+ <div class="carousel-caption">
20
+ <h5>{{ item.title }}</h5>
21
+ <p>{{ item.description }}</p>
22
+ </div>
23
+ </div>
24
+ </template>
25
+ </div>
26
+ <template v-if="control">
27
+ <button class="carousel-control-prev" type="button" :data-bs-target="`#${id}`" data-bs-slide="prev">
28
+ <span class="carousel-control-prev-icon" aria-hidden="true"></span>
29
+ <span class="visually-hidden">Previous</span>
30
+ </button>
31
+ <button class="carousel-control-next" type="button" :data-bs-target="`#${id}`" data-bs-slide="next">
32
+ <span class="carousel-control-next-icon" aria-hidden="true"></span>
33
+ <span class="visually-hidden">Next</span>
34
+ </button>
35
+ </template>
36
+ </div>
37
+ </template>
38
+
39
+ <script setup>
40
+ import { useId, onMounted, onBeforeUnmount } from 'vue';
41
+ import Carousel from 'bootstrap/js/dist/carousel';
42
+
43
+ const id = useId();
44
+ const props = defineProps({
45
+ items: {
46
+ type: Array,
47
+ required: true
48
+ },
49
+ carouselClass: {
50
+ type: String,
51
+ default: null
52
+ },
53
+ interval: {
54
+ type: Number,
55
+ default: 5000
56
+ },
57
+ keyboard: {
58
+ type: Boolean,
59
+ default: true
60
+ },
61
+ pause: {
62
+ type: [String, Boolean],
63
+ default: 'hover'
64
+ },
65
+ ride: {
66
+ type: [String, Boolean],
67
+ default: false
68
+ },
69
+ touch: {
70
+ type: Boolean,
71
+ default: true
72
+ },
73
+ wrap: {
74
+ type: Boolean,
75
+ default: true
76
+ },
77
+ control: {
78
+ type: Boolean,
79
+ default: true
80
+ },
81
+ indicator: {
82
+ type: Boolean,
83
+ default: true
84
+ }
85
+ });
86
+
87
+ let carousel = null;
88
+ onMounted(() => {
89
+ if (carousel === null) {
90
+ carousel = new Carousel(`#${id}`, {
91
+ interval: props.interval,
92
+ keyboard: props.keyboard,
93
+ pause: props.pause,
94
+ ride: props.ride,
95
+ touch: props.touch,
96
+ wrap: props.wrap
97
+ });
98
+ }
99
+ });
100
+
101
+ onBeforeUnmount(() => {
102
+ if (carousel !== null) {
103
+ carousel.dispose();
104
+ carousel = null;
105
+ }
106
+ });
107
+ </script>