generated from Tahul/vue-composable-starter
-
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add useVueDappModal for another approach to open the modal
- Loading branch information
1 parent
d99bbb1
commit 6eea040
Showing
13 changed files
with
163 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,39 @@ | ||
# @vue-dapp/modal | ||
|
||
<a href="https://www.npmjs.com/package/@vue-dapp/modal"><img src="https://badgen.net/npm/v/@vue-dapp/modal" alt="Version"></a> | ||
<a href="https://www.npmjs.com/package/@vue-dapp/modal"><img src="https://badgen.net/npm/v/@vue-dapp/modal" alt="Version"></a> | ||
|
||
|
||
|
||
## Two approach to open/close the modal | ||
|
||
### v-model | ||
|
||
```ts | ||
const isModalOpen = ref(false) | ||
|
||
``` | ||
|
||
Must add `v-model` | ||
```vue | ||
<VueDappModal | ||
v-model="isModalOpen" | ||
autoConnect | ||
/> | ||
``` | ||
|
||
### pinia store | ||
|
||
- only works with SPA | ||
|
||
```ts | ||
import { useVueDappStore } from '@vue-dapp/modal' | ||
|
||
const { open, close } = useVueDappStore() | ||
``` | ||
|
||
Don't add `v-model` | ||
```vue | ||
<VueDappModal | ||
autoConnect | ||
/> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
import VueDappModal from './VueDappModal.vue' | ||
export { VueDappModal } | ||
|
||
export * from './store' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { ref } from 'vue' | ||
import { defineStore } from 'pinia' | ||
|
||
export const useVueDappModal = defineStore('vd-modal-store', () => { | ||
const isModalOpen = ref(false) | ||
|
||
function open() { | ||
isModalOpen.value = true | ||
} | ||
|
||
function close() { | ||
isModalOpen.value = false | ||
} | ||
|
||
return { | ||
isModalOpen, | ||
open, | ||
close, | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
packages/modal/vite.config.mjs.timestamp-1713497930639-df0fdac8b8d7d.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// vite.config.mjs | ||
import { defineConfig } from "file:///Users/johnson/vue-dapp/node_modules/.pnpm/vite@5.2.9_sass@1.70.0/node_modules/vite/dist/node/index.js"; | ||
import vue from "file:///Users/johnson/vue-dapp/node_modules/.pnpm/@vitejs+plugin-vue@5.0.3_vite@5.2.9_vue@3.4.21/node_modules/@vitejs/plugin-vue/dist/index.mjs"; | ||
import path from "path"; | ||
import dts from "file:///Users/johnson/vue-dapp/node_modules/.pnpm/vite-plugin-dts@3.7.2_typescript@5.3.3_vite@5.2.9/node_modules/vite-plugin-dts/dist/index.mjs"; | ||
var __vite_injected_original_dirname = "/Users/johnson/vue-dapp/packages/modal"; | ||
var vite_config_default = defineConfig({ | ||
plugins: [ | ||
vue(), | ||
dts({ | ||
insertTypesEntry: true | ||
}) | ||
], | ||
build: { | ||
assetsDir: "assets", | ||
lib: { | ||
entry: path.resolve(__vite_injected_original_dirname, "src/index.ts"), | ||
name: "@vue-dapp/modal", | ||
fileName: "modal" | ||
}, | ||
outDir: "dist", | ||
rollupOptions: { | ||
external: ["vue", "pinia", "@vue-dapp/core"], | ||
output: { | ||
dir: "dist", | ||
globals: { | ||
vue: "vue", | ||
pinia: "pinia", | ||
"@vue-dapp/core": "core" | ||
} | ||
} | ||
} | ||
} | ||
}); | ||
export { | ||
vite_config_default as default | ||
}; | ||
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsidml0ZS5jb25maWcubWpzIl0sCiAgInNvdXJjZXNDb250ZW50IjogWyJjb25zdCBfX3ZpdGVfaW5qZWN0ZWRfb3JpZ2luYWxfZGlybmFtZSA9IFwiL1VzZXJzL2pvaG5zb24vdnVlLWRhcHAvcGFja2FnZXMvbW9kYWxcIjtjb25zdCBfX3ZpdGVfaW5qZWN0ZWRfb3JpZ2luYWxfZmlsZW5hbWUgPSBcIi9Vc2Vycy9qb2huc29uL3Z1ZS1kYXBwL3BhY2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