Open a982246809 opened 2 months ago
Hello. What functionality would you like to see in onBeforeModalOpen
. I'm using onMounted
instead, but if there's a need I'll add it.
As I understand it, you control the opening of the fashion window in the fashion window itself?
我有一个全局状态 switch , 当switch=false时 , 我希望在全局任意的调用都不会生效
I have a global state switch
. When switch=false
, I hope that any global call openModal
will not take effect.
Okay, I will add it today!
可能在vue文件中加onBeforeModalOpen
并不起作用 , 因为一开始并不会初始化
Adding onBeforeModalOpen
to the vue file may not work, because it will not be initialized at first
It will looks like it:
import {config} from "jenesius-vue-modal"
config({
beforeEach() {
if (global.switch === false) return false;
}
})
How do you like it? Or add just:
import {beforeEach} from "jenesius-vue-modal"
But this is too general a function, I don't want to clutter up the import space
Please note version 1.11.7. I added the beforeEach
function to the config.
import {config} from "jenesius-vue-modal"
config({
beforeEach() {
if (global.switch === false) return false;
}
})
Thanks for your help in improving the library!
thanks , This library is great.
Can each Modal be managed individually? For example: 可以对每个Modal进行单独的管理吗 , 例如
config({
store: {
Foo: {
component:FooComp ,
beforeEach() {
if (global.switch === false) return false;
}
}
}
})
@Jenesius
In this case, it is important to understand that this hook will only work when called by name.
I'll try to come up with something and write about it as I go along
Can each Modal be managed individually? For example:每个Modal可以单独管理吗?例如: 可以对每个Modal进行单独的管理吗 , 例如
config({ store: { Foo: { component:FooComp , beforeEach() { if (global.switch === false) return false; } } } })
backgroundClose also needs to be configured for a separate modal backgroundClose 也需要对单独的modal进行配置
I'll try to show the result tomorrow, as long as I have this interface:
export interface IStoreComponentConfiguration {
component: Component,
beforeEach: unknown,
backgroundClose: unknown,
scrollLock: unknown,
animation: unknown,
escClose: unknown,
draggable: unknown,
}
config({
store: {
Foo: IStoreComponentConfiguration
}
})
Now will available only draggable
, beforeEach
, backgroundClose
. The rest will also need to be taken out, but they are not yet located inside the modal window, but are taken directly from the configuration.
There is an onBeforeModalClose, can you add an onBeforeModalOpen?