Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
npm
/
glsx-components
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit ea1335dc
authored
Aug 17, 2022
by
luyt
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat:修复GLDialog添加到body的问题
1 parent
e5da3922
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
3 deletions
src/App.vue
src/packages/GLDialog/src/index.vue
src/App.vue
View file @
ea1335d
...
@@ -171,7 +171,7 @@
...
@@ -171,7 +171,7 @@
<el-button
plain
@
click=
"testDialog3"
>
dialog(中)无按钮
</el-button>
<el-button
plain
@
click=
"testDialog3"
>
dialog(中)无按钮
</el-button>
<el-button
plain
@
click=
"testBeforeDialog"
>
之前小弹窗
</el-button>
<el-button
plain
@
click=
"testBeforeDialog"
>
之前小弹窗
</el-button>
<!-- :content="'hello HelloWorld'" -->
<!-- :content="'hello HelloWorld'" -->
<GLDialog
:mode=
"mode"
bigTitle=
"大标题"
:hasFooter=
"hasFooter"
:type=
"'error'"
@
onOk=
"handleOk"
@
onCancel=
"handleCancel"
:visible
.
sync=
"dialogShow"
>
<GLDialog
:
append-to-body=
"true"
:
mode=
"mode"
bigTitle=
"大标题"
:hasFooter=
"hasFooter"
:type=
"'error'"
@
onOk=
"handleOk"
@
onCancel=
"handleCancel"
:visible
.
sync=
"dialogShow"
>
<div>
<div>
<div>
这是一段信息
</div>
<div>
这是一段信息
</div>
<div>
这是一段信息
</div>
<div>
这是一段信息
</div>
...
@@ -240,7 +240,7 @@
...
@@ -240,7 +240,7 @@
<el-button type="primary" size="small" @click="dialogShow = false">确定123</el-button>
<el-button type="primary" size="small" @click="dialogShow = false">确定123</el-button>
</span> -->
</span> -->
</GLDialog>
</GLDialog>
<GLDialog
:
mode=
"mode"
title=
"提示
"
:hasFooter=
"hasFooter"
:type=
"'error'"
:content=
"'hello HelloWorld'"
@
onOk=
"handleOk"
@
onCancel=
"handleCancel"
:visible
.
sync=
"dialogShow2"
></GLDialog>
<GLDialog
:
append-to-body=
"true"
:mode=
"mode"
title=
"提示中
"
:hasFooter=
"hasFooter"
:type=
"'error'"
:content=
"'hello HelloWorld'"
@
onOk=
"handleOk"
@
onCancel=
"handleCancel"
:visible
.
sync=
"dialogShow2"
></GLDialog>
<GLDialog
title=
"提示123"
:mode=
"mode"
:hasFooter=
"hasFooter"
:type=
"'info'"
:content=
"'hello HelloWorld'"
@
onOk=
"handleOk"
@
onCancel=
"handleCancel"
:visible
.
sync=
"dialogShow1"
></GLDialog>
<GLDialog
title=
"提示123"
:mode=
"mode"
:hasFooter=
"hasFooter"
:type=
"'info'"
:content=
"'hello HelloWorld'"
@
onOk=
"handleOk"
@
onCancel=
"handleCancel"
:visible
.
sync=
"dialogShow1"
></GLDialog>
<!-- <GLDialog title="提示123" :mode="mode" :hasFooter="hasFooter" :type="'info'" @onOk="handleOk" @onCancel="handleCancel" :visible.sync="dialogShow1">
<!-- <GLDialog title="提示123" :mode="mode" :hasFooter="hasFooter" :type="'info'" @onOk="handleOk" @onCancel="handleCancel" :visible.sync="dialogShow1">
<div>hello</div>
<div>hello</div>
...
...
src/packages/GLDialog/src/index.vue
View file @
ea1335d
<
template
>
<
template
>
<div
class=
"gl-dialog-wrap "
:class=
"mode"
:id=
"idDom"
>
<div
class=
"gl-dialog-wrap "
:class=
"mode"
:id=
"idDom"
>
<el-dialog
v-bind=
"$attrs"
v-on=
"$listeners"
>
<el-dialog
v-bind=
"$attrs"
v-on=
"$listeners"
>
<template
v-slot:title
>
<template
v-slot:title
>
<!-- 标题插槽 -->
<!-- 标题插槽 -->
...
@@ -88,6 +88,11 @@ export default {
...
@@ -88,6 +88,11 @@ export default {
type
:
String
,
type
:
String
,
// `success` / `info` / `warning` / `error`
// `success` / `info` / `warning` / `error`
default
:
''
default
:
''
},
// 是否添加到body
appendToBody
:{
type
:
Boolean
,
default
:
false
}
}
},
},
data
()
{
data
()
{
...
@@ -100,6 +105,9 @@ export default {
...
@@ -100,6 +105,9 @@ export default {
document
.
addEventListener
(
'keyup'
,
(
e
)
=>
{
document
.
addEventListener
(
'keyup'
,
(
e
)
=>
{
this
.
keyupHook
(
e
)
this
.
keyupHook
(
e
)
});
});
if
(
this
.
appendToBody
)
{
document
.
body
.
appendChild
(
this
.
$el
);
}
},
},
computed
:
{
computed
:
{
okName
:
function
()
{
okName
:
function
()
{
...
@@ -204,6 +212,9 @@ export default {
...
@@ -204,6 +212,9 @@ export default {
document
.
removeEventListener
(
'keyup'
,(
e
)
=>
{
document
.
removeEventListener
(
'keyup'
,(
e
)
=>
{
this
.
keyupHook
(
e
)
this
.
keyupHook
(
e
)
})
})
if
(
this
.
appendToBody
&&
this
.
$el
&&
this
.
$el
.
parentNode
)
{
this
.
$el
.
parentNode
.
removeChild
(
this
.
$el
);
}
}
}
}
}
</
script
>
</
script
>
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment