contents-popup-redtombo 1.0.2 → 1.0.4

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.
@@ -24,6 +24,7 @@ watch(
24
24
  component, // 監視対象としてリアクティブな `component` を指定
25
25
  (newComponent: string) => {
26
26
  changePopup(newComponent); // ポップアップを変更する
27
+ console.log("test");
27
28
  }
28
29
  );
29
30
 
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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "contents-popup-redtombo",
3
- "version": "1.0.2",
4
- "description": "中のコンポーネントを変更できるポップアップ",
3
+ "version": "1.0.4",
4
+ "description": "中のComponentsを動的に切り替えれるポップアップ",
5
5
  "main": "./module.ts",
6
6
  "exports": {
7
7
  ".": "./module.ts"
@@ -1,3 +0,0 @@
1
- <template>
2
- DeleteSong
3
- </template>
@@ -1,3 +0,0 @@
1
- <template>
2
- EditSong
3
- </template>
@@ -1,23 +0,0 @@
1
- interface State {
2
- component: string; //コンポーネント
3
- }
4
-
5
- // グローバルな状態管理
6
- const state = reactive<State>({
7
- component: "EditSong",
8
- });
9
-
10
- export function useComponent() {
11
- function changeComponent(): void {
12
- if (state.component === "EditSong") {
13
- state.component = "DeleteSong";
14
- } else {
15
- state.component = "EditSong";
16
- }
17
- }
18
-
19
- return {
20
- changeComponent,
21
- state,
22
- };
23
- }