Skip to content

Commit

Permalink
🐛 fix compatibility
Browse files Browse the repository at this point in the history
=
  • Loading branch information
huanghuiquan committed Jun 12, 2018
1 parent e5d3d7a commit 602028e
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
},
"homepage": "https://github.com/mipengine/mip2#readme",
"devDependencies": {
"babel-plugin-transform-builtin-classes": "^0.6.1",
"babel-plugin-transform-custom-element-classes": "^0.1.0",
"eslint": "^5.0.0-alpha",
"eslint-config-standard": "^12.0.0-alpha",
Expand Down
4 changes: 3 additions & 1 deletion packages/mip/.babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
"plugins": [
"syntax-dynamic-import",
"transform-object-rest-spread",
"transform-custom-element-classes",
["transform-builtin-classes", {
"globals": ["HTMLElement"]
}],
[
"transform-runtime",
{
Expand Down
8 changes: 8 additions & 0 deletions packages/mip/examples/builtin/mip-img.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
<!-- <link rel="stylesheet" href="../../dist/mip.css"></link> -->
<link rel="stylesheet" type="text/css" href="style.css">
<script>
window.onerror = function (message, source, lineno, colno, error) {
alert('Ops, js 报错了,请联系 FE 修复')
alert(message)
alert(source + ':' + lineno + ':' + colno)
alert(JSON.stringify(error))
}
</script>
</head>

<body>
Expand Down
2 changes: 1 addition & 1 deletion packages/mip/src/page/appshell/globalComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default class GlobalComponent {

_init () {
// Add initial scripts
document.querySelectorAll('script').forEach(script => {
[].slice.call(document.querySelectorAll('script')).forEach(script => {
let src = script.src || ''
let match = src.match(/\/(mip-[^/]+)\.js/)

Expand Down
2 changes: 1 addition & 1 deletion packages/mip/src/page/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ class Page {

// recaculate all the iframes' height
viewport.on('resize', () => {
document.querySelectorAll('.mip-page__iframe').forEach($el => {
[].slice.call(document.querySelectorAll('.mip-page__iframe')).forEach($el => {
$el.style.height = `${viewport.getHeight()}px`
})
})
Expand Down

0 comments on commit 602028e

Please sign in to comment.