contents-popup-redtombo 1.0.0
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.
- package/components/EditSong.vue +3 -0
- package/components/PopupContents.vue +34 -0
- package/components/popup.vue +71 -0
- package/module.ts +14 -0
- package/package.json +23 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { toRefs } from "vue";
|
|
3
|
+
import { usePopup } from "../composables/usePopup";
|
|
4
|
+
import EditSong from "~/components/EditSong.vue";
|
|
5
|
+
|
|
6
|
+
// EditSongを登録
|
|
7
|
+
const { state, closePopup, initPopup } = usePopup();
|
|
8
|
+
const { isLoading,currentComponent } = toRefs(state);
|
|
9
|
+
|
|
10
|
+
const component: string = 'EditSong';
|
|
11
|
+
const componentList: Record<string, Component> = {
|
|
12
|
+
"EditSong": EditSong
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
initPopup(componentList);
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<template>
|
|
19
|
+
<div class="d-flex justify-content-end mb-4">
|
|
20
|
+
<button @click="closePopup()" class="btn btn-close" type="button"></button>
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
<!-- currentComponentでコンポーネントの表示を切り替える。 -->
|
|
24
|
+
<p v-show="isLoading" class="text-center text-primary">
|
|
25
|
+
データ取得中...
|
|
26
|
+
</p>
|
|
27
|
+
<div v-show="!isLoading">
|
|
28
|
+
<div>
|
|
29
|
+
<!-- EditSongの表示 -->
|
|
30
|
+
<!-- <EditSong v-if="currentComponent === 'EditSong'"/> -->
|
|
31
|
+
<component :is="currentComponent" />
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
</template>
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { toRefs } from "vue";
|
|
3
|
+
import { usePopup } from "../composables/usePopup";
|
|
4
|
+
|
|
5
|
+
import PopupContents from "../components/PopupContents.vue";
|
|
6
|
+
|
|
7
|
+
const { state } = usePopup();
|
|
8
|
+
const { componentErrorMessage } = toRefs(state);
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<Teleport to="body">
|
|
14
|
+
<div
|
|
15
|
+
class="modal show fade d-flex align-items-center justify-content-center"
|
|
16
|
+
tabindex="-1"
|
|
17
|
+
style="display: block"
|
|
18
|
+
>
|
|
19
|
+
<div class="modal-dialog custom-size" @click.stop>
|
|
20
|
+
<div
|
|
21
|
+
class="modal-content p-3"
|
|
22
|
+
:class="{ 'modal-danger': componentErrorMessage }"
|
|
23
|
+
>
|
|
24
|
+
<div class="modal-body">
|
|
25
|
+
<!-- エラーメッセージ表示 -->
|
|
26
|
+
<p
|
|
27
|
+
v-if="componentErrorMessage"
|
|
28
|
+
class="text-danger"
|
|
29
|
+
>
|
|
30
|
+
エラーが発生しました<br/>
|
|
31
|
+
{{ componentErrorMessage }}
|
|
32
|
+
</p>
|
|
33
|
+
<PopupContents v-else/>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
</Teleport>
|
|
39
|
+
</template>
|
|
40
|
+
|
|
41
|
+
<style scoped>
|
|
42
|
+
.modal.show {
|
|
43
|
+
background: rgba(0, 0, 0, 0.5);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.modal-content {
|
|
47
|
+
border-radius: 8px;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.custom-size {
|
|
51
|
+
width: 1080px !important; /* 任意の幅を指定 */
|
|
52
|
+
max-width: none !important; /* 最大幅の制限を解除 */
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.modal.show {
|
|
56
|
+
display: flex !important; /* Flexbox有効 */
|
|
57
|
+
align-items: center !important; /* 縦中央揃え */
|
|
58
|
+
justify-content: center !important; /* 横中央揃え */
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.modal-danger {
|
|
62
|
+
background-color: var(
|
|
63
|
+
--bs-danger-bg-subtle,
|
|
64
|
+
#f8d7da
|
|
65
|
+
); /* Bootstrapのalert-dangerの背景色 */
|
|
66
|
+
color: var(
|
|
67
|
+
--bs-danger-text,
|
|
68
|
+
#842029
|
|
69
|
+
); /* Bootstrapのalert-dangerのテキスト色 */
|
|
70
|
+
}
|
|
71
|
+
</style>
|
package/module.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { defineNuxtModule } from '@nuxt/kit'
|
|
2
|
+
import { resolve } from 'path'
|
|
3
|
+
|
|
4
|
+
export default defineNuxtModule({
|
|
5
|
+
setup(_, nuxt) {
|
|
6
|
+
// コンポーネントディレクトリを追加
|
|
7
|
+
nuxt.hook('components:dirs', (dirs) => {
|
|
8
|
+
dirs.push({
|
|
9
|
+
path: resolve(__dirname, 'components'), // モジュール内のコンポーネントを登録
|
|
10
|
+
pathPrefix: false,
|
|
11
|
+
})
|
|
12
|
+
})
|
|
13
|
+
},
|
|
14
|
+
})
|
package/package.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "contents-popup-redtombo",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "ポップアップのコンテンツを切り替える",
|
|
5
|
+
"main": "./module.ts",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": "./module.ts"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"build": "nuxt build",
|
|
11
|
+
"dev": "nuxt dev",
|
|
12
|
+
"install": "nuxt prepare"
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"bootstrap": "^5.0.0",
|
|
16
|
+
"nuxt": "^3.0.0",
|
|
17
|
+
"nuxt-lodash": "^2.0.0"
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"module.ts",
|
|
21
|
+
"components"
|
|
22
|
+
]
|
|
23
|
+
}
|