Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_54851307
vue-vben-admin
提交
7a7dab0c
V
vue-vben-admin
项目概览
weixin_54851307
/
vue-vben-admin
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vue-vben-admin
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7a7dab0c
编写于
7月 19, 2021
作者:
无
无木
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(demo): multi-modal in one page usage
添加使用is动态组件来在页面内使用多个modal的演示
上级
59eb828d
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
39 addition
and
3 deletion
+39
-3
src/views/demo/comp/modal/index.vue
src/views/demo/comp/modal/index.vue
+39
-3
未找到文件。
src/views/demo/comp/modal/index.vue
浏览文件 @
7a7dab0c
...
...
@@ -17,6 +17,16 @@
<Alert
message=
"内外数据交互"
show-icon
/>
<a-button
type=
"primary"
class=
"my-4"
@
click=
"send"
>
打开弹窗并传递数据
</a-button>
<Alert
message=
"使用动态组件的方式在页面内使用多个弹窗"
show-icon
/>
<a-space>
<a-button
type=
"primary"
class=
"my-4"
@
click=
"openTargetModal(1)"
>
打开弹窗1
</a-button>
<a-button
type=
"primary"
class=
"my-4"
@
click=
"openTargetModal(2)"
>
打开弹窗2
</a-button>
<a-button
type=
"primary"
class=
"my-4"
@
click=
"openTargetModal(3)"
>
打开弹窗3
</a-button>
<a-button
type=
"primary"
class=
"my-4"
@
click=
"openTargetModal(4)"
>
打开弹窗4
</a-button>
</a-space>
<component
:is=
"currentModal"
@
register=
"register"
/>
<Modal1
@
register=
"register1"
:minHeight=
"100"
/>
<Modal2
@
register=
"register2"
/>
<Modal3
@
register=
"register3"
/>
...
...
@@ -24,8 +34,8 @@
</PageWrapper>
</
template
>
<
script
lang=
"ts"
>
import
{
defineComponent
}
from
'
vue
'
;
import
{
Alert
}
from
'
ant-design-vue
'
;
import
{
defineComponent
,
nextTick
,
shallowRef
,
ComponentOptions
}
from
'
vue
'
;
import
{
Alert
,
Space
}
from
'
ant-design-vue
'
;
import
{
useModal
}
from
'
/@/components/Modal
'
;
import
Modal1
from
'
./Modal1.vue
'
;
import
Modal2
from
'
./Modal2.vue
'
;
...
...
@@ -34,12 +44,14 @@
import
{
PageWrapper
}
from
'
/@/components/Page
'
;
export
default
defineComponent
({
components
:
{
Alert
,
Modal1
,
Modal2
,
Modal3
,
Modal4
,
PageWrapper
},
components
:
{
Alert
,
Modal1
,
Modal2
,
Modal3
,
Modal4
,
PageWrapper
,
ASpace
:
Space
},
setup
()
{
const
currentModal
=
shallowRef
<
Nullable
<
ComponentOptions
>>
(
null
);
const
[
register1
,
{
openModal
:
openModal1
}]
=
useModal
();
const
[
register2
,
{
openModal
:
openModal2
}]
=
useModal
();
const
[
register3
,
{
openModal
:
openModal3
}]
=
useModal
();
const
[
register4
,
{
openModal
:
openModal4
}]
=
useModal
();
const
[
register
,
{
openModal
}]
=
useModal
();
function
send
()
{
openModal4
(
true
,
{
data
:
'
content
'
,
...
...
@@ -53,6 +65,27 @@
// setModalProps({ loading: false });
// }, 2000);
}
function
openTargetModal
(
index
)
{
switch
(
index
)
{
case
1
:
currentModal
.
value
=
Modal1
;
break
;
case
2
:
currentModal
.
value
=
Modal2
;
break
;
case
3
:
currentModal
.
value
=
Modal3
;
break
;
default
:
currentModal
.
value
=
Modal4
;
break
;
}
nextTick
(()
=>
{
openModal
(
true
,
{
data
:
'
content
'
,
info
:
'
Info
'
});
});
}
return
{
register1
,
openModal1
,
...
...
@@ -62,7 +95,10 @@
openModal3
,
register4
,
openModal4
,
register
,
openTargetModal
,
send
,
currentModal
,
openModalLoading
,
};
},
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录