Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
IPC-footer
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Allen Bai
IPC-footer
Commits
4daf5a06
Commit
4daf5a06
authored
Feb 01, 2021
by
Allen Bai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 添加测试用例
parent
2ad658db
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
231 additions
and
6 deletions
+231
-6
h5_async.html
example/inHTML/h5_async.html
+64
-0
h5_customize.html
example/inHTML/h5_customize.html
+14
-2
h5_remount.html
example/inHTML/h5_remount.html
+74
-0
h5_remount2.html
example/inHTML/h5_remount2.html
+76
-0
index.ts
src/index.ts
+3
-4
No files found.
example/inHTML/h5_async.html
0 → 100644
View file @
4daf5a06
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1, maximum-scale=1"
>
<title>
异步挂载
</title>
<style>
*
{
margin
:
0
;
padding
:
0
;
}
html
,
body
{
background-color
:
rgb
(
35
,
155
,
86
);
}
.detail-main
{
height
:
200px
;
position
:
relative
;
transform
:
translateY
(
50%
);
border
:
3px
solid
black
;
}
</style>
</head>
<body>
<div
id=
"view"
style=
"height: 200vh;border:5px slateblue solid"
>
<p>
挂载到异步生成的dom节点上
</p>
</div>
<script>
(
function
(
e
)
{
const
IPCFooterConfig
=
{
dom
:
'.detail-main'
,
footerStyles
:
{
position
:
'static'
,
margin
:
'8px 0 60px 0'
}
}
function
loadScript
()
{
var
r
=
document
.
createElement
(
"script"
);
(
r
.
async
=
!
0
),
(
r
.
src
=
"../../dist/IPCHelper.main.js"
),
(
r
.
crossOrigin
=
"anonymous"
),
(
r
.
onload
=
function
()
{
window
.
__TUIA_IPC_HELPER__
&&
window
.
__TUIA_IPC_HELPER__
.
mountIPCFooter
(
IPCFooterConfig
)
}),
document
.
body
&&
document
.
body
.
appendChild
(
r
);
};
loadScript
()
})(
window
);
</script>
<script>
var
view
=
document
.
querySelector
(
'#view'
)
setTimeout
(()
=>
{
let
ele
=
document
.
createElement
(
'div'
)
ele
.
classList
.
add
(
'detail-main'
)
view
.
appendChild
(
ele
)
},
2000
)
</script>
</body>
</html>
example/inHTML/h5_customize.html
View file @
4daf5a06
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
<head>
<head>
<meta
charset=
"UTF-8"
>
<meta
charset=
"UTF-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1, maximum-scale=1"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1, maximum-scale=1"
>
<title>
线上页面引入方法
</title>
<title>
自定义参数
</title>
<style>
<style>
*
{
*
{
margin
:
0
;
margin
:
0
;
...
@@ -15,12 +15,24 @@
...
@@ -15,12 +15,24 @@
body
{
body
{
background-color
:
rgb
(
35
,
155
,
86
);
background-color
:
rgb
(
35
,
155
,
86
);
}
}
.detail-main
{
height
:
200px
;
position
:
relative
;
transform
:
translateY
(
50%
);
border
:
3px
solid
black
;
}
</style>
</style>
</head>
</head>
<body>
<body>
<div
style=
"height: 200vh;border:5px slateblue solid"
></div>
<div
style=
"height: 200vh;border:5px slateblue solid"
>
<p>
自定义参数
</p>
<div
class=
"detail-main"
>
</div>
</div>
<script>
<script>
// 自定义参数
// 百奇商品详情页建议用这个
// 百奇商品详情页建议用这个
(
function
(
e
)
{
(
function
(
e
)
{
const
IPCFooterConfig
=
{
const
IPCFooterConfig
=
{
...
...
example/inHTML/h5_remount.html
0 → 100644
View file @
4daf5a06
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1, maximum-scale=1"
>
<title>
remount测试
</title>
<style>
*
{
margin
:
0
;
padding
:
0
;
}
html
,
body
{
background-color
:
rgb
(
35
,
155
,
86
);
}
.detail-main
{
height
:
200px
;
position
:
relative
;
transform
:
translateY
(
50%
);
border
:
3px
solid
black
;
}
</style>
</head>
<body>
<div
id=
"view"
style=
"height: 200vh;border:5px slateblue solid"
>
<p>
在第一次挂载之前,调用remount方法
</p>
</div>
<script>
(
function
(
e
)
{
const
IPCFooterConfig
=
{
dom
:
'.detail-main'
,
footerStyles
:
{
position
:
'static'
,
margin
:
'8px 0 60px 0'
}
}
function
loadScript
()
{
var
r
=
document
.
createElement
(
"script"
);
(
r
.
async
=
!
0
),
(
r
.
src
=
"../../dist/IPCHelper.main.js"
),
(
r
.
crossOrigin
=
"anonymous"
),
(
r
.
onload
=
function
()
{
window
.
__TUIA_IPC_HELPER__
&&
window
.
__TUIA_IPC_HELPER__
.
mountIPCFooter
(
IPCFooterConfig
)
}),
document
.
body
&&
document
.
body
.
appendChild
(
r
);
};
loadScript
()
})(
window
);
</script>
<script>
var
view
=
document
.
querySelector
(
'#view'
)
setTimeout
(()
=>
{
let
ele
=
document
.
createElement
(
'div'
)
ele
.
classList
.
add
(
'detail-main'
)
view
.
appendChild
(
ele
)
window
.
__TUIA_IPC_HELPER__
.
remount
({
dom
:
'.detail-main'
,
footerStyles
:
{
position
:
'static'
,
margin
:
'8px 0 60px 0'
,
},
boardStyles
:
{
backgroundColor
:
'yellow'
}
})
},
2000
)
</script>
</body>
</html>
example/inHTML/h5_remount2.html
0 → 100644
View file @
4daf5a06
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1, maximum-scale=1"
>
<title>
remount测试
</title>
<style>
*
{
margin
:
0
;
padding
:
0
;
}
html
,
body
{
background-color
:
rgb
(
35
,
155
,
86
);
}
.detail-main
{
height
:
200px
;
position
:
relative
;
transform
:
translateY
(
50%
);
border
:
3px
solid
black
;
}
</style>
</head>
<body>
<div
id=
"view"
style=
"height: 200vh;border:5px slateblue solid"
>
<p>
在第一次挂载之后,调用remount方法
</p>
</div>
<script>
(
function
(
e
)
{
const
IPCFooterConfig
=
{
dom
:
'.detail-main'
,
footerStyles
:
{
position
:
'static'
,
margin
:
'8px 0 60px 0'
}
}
function
loadScript
()
{
var
r
=
document
.
createElement
(
"script"
);
(
r
.
async
=
!
0
),
(
r
.
src
=
"../../dist/IPCHelper.main.js"
),
(
r
.
crossOrigin
=
"anonymous"
),
(
r
.
onload
=
function
()
{
window
.
__TUIA_IPC_HELPER__
&&
window
.
__TUIA_IPC_HELPER__
.
mountIPCFooter
(
IPCFooterConfig
)
}),
document
.
body
&&
document
.
body
.
appendChild
(
r
);
};
loadScript
()
})(
window
);
</script>
<script>
var
view
=
document
.
querySelector
(
'#view'
)
setTimeout
(()
=>
{
let
ele
=
document
.
createElement
(
'div'
)
ele
.
classList
.
add
(
'detail-main'
)
view
.
appendChild
(
ele
)
setTimeout
(()
=>
{
window
.
__TUIA_IPC_HELPER__
.
remount
({
dom
:
'.detail-main'
,
footerStyles
:
{
position
:
'static'
,
margin
:
'8px 0 60px 0'
,
},
boardStyles
:
{
backgroundColor
:
'yellow'
}
})
},
1000
)
},
2000
)
</script>
</body>
</html>
src/index.ts
View file @
4daf5a06
...
@@ -125,23 +125,22 @@ async function mountIPCFooter(opts: IPCFooterOptions = {}) {
...
@@ -125,23 +125,22 @@ async function mountIPCFooter(opts: IPCFooterOptions = {}) {
IPCFooter
.
id
=
'__IPC_footer__'
IPCFooter
.
id
=
'__IPC_footer__'
IPCBoard
.
id
=
'__IPC_board__'
IPCBoard
.
id
=
'__IPC_board__'
addStyles
(
IPCFooter
,
{
...
defaultFooterStyles
,
...(
opts
.
footerStyles
||
{})
})
addStyles
(
IPCFooter
,
{
...
defaultFooterStyles
,
...(
opts
.
footerStyles
||
{})
})
addStyles
(
IPCBoard
,
{
...
defaultBoardStyles
,
...(
opts
.
footer
Styles
||
{})
})
addStyles
(
IPCBoard
,
{
...
defaultBoardStyles
,
...(
opts
.
board
Styles
||
{})
})
IPCBoard
.
innerText
=
(
IPCNumberString
as
string
)
||
'IPC备-'
IPCBoard
.
innerText
=
(
IPCNumberString
as
string
)
||
'IPC备-'
IPCBoard
.
href
=
'https://beian.miit.gov.cn/#/Integrated/index'
IPCBoard
.
href
=
'https://beian.miit.gov.cn/#/Integrated/index'
IPCFooter
.
appendChild
(
IPCBoard
)
IPCFooter
.
appendChild
(
IPCBoard
)
let
tryCount
=
6
let
tryCount
=
10
function
__mount__
()
{
function
__mount__
()
{
let
targetDom
let
targetDom
if
(
opts
.
dom
===
undefined
||
opts
.
dom
===
null
)
{
if
(
opts
.
dom
===
undefined
||
opts
.
dom
===
null
)
{
targetDom
=
document
.
querySelector
(
'body'
)
targetDom
=
document
.
querySelector
(
'body'
)
}
else
if
(
typeof
opts
.
dom
===
'string'
)
{
}
else
if
(
typeof
opts
.
dom
===
'string'
)
{
targetDom
=
document
.
querySelector
(
targetD
om
)
targetDom
=
document
.
querySelector
(
opts
.
d
om
)
}
else
{
}
else
{
targetDom
=
opts
.
dom
targetDom
=
opts
.
dom
}
}
if
(
!
targetDom
)
{
if
(
!
targetDom
)
{
// 可能目标dom节点还没挂载
// 可能目标dom节点还没挂载
if
(
tryCount
>
0
)
{
if
(
tryCount
>
0
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment