From 19afc7a2332b75ea51671c946e89957a8d8de1c2 Mon Sep 17 00:00:00 2001 From: mip-platform Date: Thu, 16 May 2019 17:10:51 +0800 Subject: [PATCH 1/2] mip-platform auto create Pull Request --- mip-component-fulltoscreen/README.md | 26 +++++++++++++++++++ .../mip-component-fulltoscreen.js | 24 +++++++++++++++++ .../mip-component-fulltoscreen.less | 7 +++++ mip-component-fulltoscreen/package.json | 14 ++++++++++ 4 files changed, 71 insertions(+) create mode 100644 mip-component-fulltoscreen/README.md create mode 100644 mip-component-fulltoscreen/mip-component-fulltoscreen.js create mode 100644 mip-component-fulltoscreen/mip-component-fulltoscreen.less create mode 100644 mip-component-fulltoscreen/package.json diff --git a/mip-component-fulltoscreen/README.md b/mip-component-fulltoscreen/README.md new file mode 100644 index 00000000..03a6ea96 --- /dev/null +++ b/mip-component-fulltoscreen/README.md @@ -0,0 +1,26 @@ +# mip-component-fulltoscreen + +mip-component-fulltoscreen 用于当页面不足一屏时,组件节点拓展至一屏 + +标题|内容 +----|---- +类型|通用 +支持布局|responsive,fixed-height,fill,container,fixed +所需脚本|https://c.mipcdn.com/static/v1/mip-component-fulltoscreen/mip-component-fulltoscreen.js + +## 示例 + +### 基本用法 +```html + + 自定义内容,可以嵌套其他组件 + +``` + +## 属性 + +无 + +## 注意事项 + +无 \ No newline at end of file diff --git a/mip-component-fulltoscreen/mip-component-fulltoscreen.js b/mip-component-fulltoscreen/mip-component-fulltoscreen.js new file mode 100644 index 00000000..66f695b7 --- /dev/null +++ b/mip-component-fulltoscreen/mip-component-fulltoscreen.js @@ -0,0 +1,24 @@ +/** + * @file mip-component-fulltoscreen 组件 + * @author + */ + +define(function (require) { + 'use strict'; + + var customElement = require('customElement').create(); + var $ = require('jquery'); + + customElement.prototype.firstInviewCallback = function () { + var element = this.element; + var bodyHeight = $('body').outerHeight(true); + var windowHeight = $(window).height(); + if (bodyHeight < windowHeight) { + var lastDom = $('.fix-bottom').prev(); + var remainHeight = $(lastDom).position().top + $(lastDom).outerHeight(true); + $(element).css('min-height', $(element).height() + remainHeight - 50); + } + $('body').css('visibility', 'visible'); + }; + return customElement; +}); diff --git a/mip-component-fulltoscreen/mip-component-fulltoscreen.less b/mip-component-fulltoscreen/mip-component-fulltoscreen.less new file mode 100644 index 00000000..0999d3f0 --- /dev/null +++ b/mip-component-fulltoscreen/mip-component-fulltoscreen.less @@ -0,0 +1,7 @@ +/** + * @file mip-component-fulltoscreen样式文件 + */ + +mip-component-fulltoscreen { + // TODO +} diff --git a/mip-component-fulltoscreen/package.json b/mip-component-fulltoscreen/package.json new file mode 100644 index 00000000..c5a68268 --- /dev/null +++ b/mip-component-fulltoscreen/package.json @@ -0,0 +1,14 @@ +{ + "name": "mip-component-fulltoscreen", + "version": "1.0.0", + "description": "用于当页面不足一屏时,组件节点拓展至一屏", + "contributors": [ + { + "name": "林登峰", + "email": "759952225@qq.com" + } + ], + "engines": { + "mip": ">=1.1.0" + } +} From 1bb8479eff120f33d25a3fab8044bd9d44e9b742 Mon Sep 17 00:00:00 2001 From: mip-platform Date: Thu, 16 May 2019 17:24:55 +0800 Subject: [PATCH 2/2] mip-platform auto create Pull Request --- mip-component-fulltoscreen/mip-component-fulltoscreen.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/mip-component-fulltoscreen/mip-component-fulltoscreen.js b/mip-component-fulltoscreen/mip-component-fulltoscreen.js index 66f695b7..f367da40 100644 --- a/mip-component-fulltoscreen/mip-component-fulltoscreen.js +++ b/mip-component-fulltoscreen/mip-component-fulltoscreen.js @@ -14,9 +14,8 @@ define(function (require) { var bodyHeight = $('body').outerHeight(true); var windowHeight = $(window).height(); if (bodyHeight < windowHeight) { - var lastDom = $('.fix-bottom').prev(); - var remainHeight = $(lastDom).position().top + $(lastDom).outerHeight(true); - $(element).css('min-height', $(element).height() + remainHeight - 50); + var remainHeight = windowHeight - bodyHeight; + $(element).css('min-height', $(element).height() + remainHeight); } $('body').css('visibility', 'visible'); };