Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add mip-fitpx #852

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions sites/d8xz.com/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
UTF-8
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org
root = true
[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.{js,styl,html,json,vue}]
indent_size = 2
indent_style = space
[*.md]
trim_trailing_whitespace = false
2 changes: 2 additions & 0 deletions sites/d8xz.com/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist
node_modules
39 changes: 39 additions & 0 deletions sites/d8xz.com/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"parser": "vue-eslint-parser",
"parserOptions": {
"ecmaVersion": 8,
"sourceType": "module",
"allowImportExportEverywhere": false
},
"extends": [
"standard",
"plugin:vue/recommended"
],
"plugins": [
"jsdoc"
],
"globals": {
"MIP": true
},
"env": {
"browser": true
},
"rules": {
"jsdoc/check-param-names": 1,
"jsdoc/check-tag-names": 1,
"jsdoc/check-types": 1,
"jsdoc/newline-after-description": 1,
"jsdoc/no-undefined-types": 1,
"jsdoc/require-description-complete-sentence": 0,
"jsdoc/require-example": 0,
"jsdoc/require-hyphen-before-param-description": 0,
"jsdoc/require-param": 1,
"jsdoc/require-param-description": 1,
"jsdoc/require-param-name": 1,
"jsdoc/require-param-type": 1,
"jsdoc/require-returns-description": 1,
"jsdoc/require-returns-type": 1,
"jsdoc/valid-types": 1,
"no-var": 2
}
}
8 changes: 8 additions & 0 deletions sites/d8xz.com/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
node_modules/
dist/
.idea/
*.log
Thumbs.db
.DS_Store
*.swp
*.gz
Empty file added sites/d8xz.com/common/.gitkeep
Empty file.
32 changes: 32 additions & 0 deletions sites/d8xz.com/components/mip-d8xz-fitpx/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# mip-d8xz-fitpx

标题|内容
----|----
类型|
支持布局|
所需脚本| [https://c.mipcdn.com/extensions/platform/v2/d8xz.com/mip-d8xz-fitpx/mip-d8xz-fitpx.js](https://c.mipcdn.com/extensions/platform/v2/d8xz.com/mip-d8xz-fitpx/mip-d8xz-fitpx.js)

## 说明

组件功能说明
用于项目mip页面rem布局屏幕适配,非常简单的一个组件.
## 示例

示例说明

```
// 代码示例
<mip-fdx-fitpx></mip-fdx-fitpx>
```

## 属性

### 属性1

**说明**:

**必选项**:

**单位**:

**默认值**:
20 changes: 20 additions & 0 deletions sites/d8xz.com/components/mip-d8xz-fitpx/example/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html mip>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1,user-scalable=no">
<title>MIP page</title>
<link rel="canonical" href="对应的原页面地址">
<link rel="stylesheet" href="https://c.mipcdn.com/static/v2/mip.css">
<style mip-custom>
/* 自定义样式 */
</style>
</head>
<body>
<div>
<mip-d8xz-fitpx></mip-d8xz-fitpx>
</div>
<script src="https://c.mipcdn.com/static/v2/mip.js"></script>
<script src="/mip-d8xz-fitpx/mip-d8xz-fitpx.js"></script>
</body>
</html>
6 changes: 6 additions & 0 deletions sites/d8xz.com/components/mip-d8xz-fitpx/index.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
mip-d8xz-fitpx {
.wrapper {
margin: 0 auto;
text-align: center;
}
}
34 changes: 34 additions & 0 deletions sites/d8xz.com/components/mip-d8xz-fitpx/mip-d8xz-fitpx.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import './index.less'

export default class MIPD8xzFitpx extends MIP.CustomElement {
build () {
"use strict";
const pageStartTime = +new Date;
~ function(e) {
function t() {
const t = screen.width > 0 && (e.innerWidth >= screen.width || 0 == e.innerWidth) ? screen.width : e.innerWidth;
a && (t = screen.width);
const i = t > u ? w : t / (u / 100);
i = i > h ? i : h, document.documentElement.style.fontSize = i + "px"
}
const n = e.navigator.userAgent,
a = n.match(/iphone/i),
o = n.match(/yixin/i),
c = n.match(/Mb2345/i),
r = n.match(/mso_app/i),
s = n.match(/sogoumobilebrowser/gi),
m = n.match(/liebaofast/i),
d = n.match(/GNBR/i),
u = document.documentElement.dataset.dw || 750,
h = 42,
w = 100;
e.addEventListener("resize", function() {
clearTimeout(i), i = setTimeout(t, 300)
}, !1), e.addEventListener("pageshow", function(e) {
e.persisted && (clearTimeout(i), i = setTimeout(t, 300))
}, !1), o || c || r || s || m || d ? setTimeout(function() {
t()
}, 500) : t()
}(window);
}
}
26 changes: 26 additions & 0 deletions sites/d8xz.com/example/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<!DOCTYPE html>
<html mip>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1,user-scalable=no">
<title>MIP page</title>
<link rel="canonical" href="对应的原页面地址">
<link rel="stylesheet" href="https://c.mipcdn.com/static/v2/mip.css">
<style mip-custom>
/* 自定义样式 */
h2 {
margin: 50px auto;
text-align: center;
}
</style>
</head>
<body>
<div>
<h2>First MIP page</h2>
<h2>Add MIP components here</h2>
<mip-example></mip-example>
</div>
<script src="https://c.mipcdn.com/static/v2/mip.js"></script>
<script src="/mip-example/mip-example.js"></script>
</body>
</html>
31 changes: 31 additions & 0 deletions sites/d8xz.com/mip.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/**
* @file mip页面项目配置项
* @author
*/

module.exports = {
dev: {
/**
* 启动mip server调试的端口号
*
* @type {number}
*/
port: 8111,

/**
* 启用调试页面自动刷新
*
* @type {boolean}
*/
livereload: true,

/**
* server 启动自动打开页面,false 为关闭
* 如:
* autoopen: '/example/index.html'
*
* @type {string|boolean}
*/
autoopen: false
}
}
25 changes: 25 additions & 0 deletions sites/d8xz.com/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "d8xz.com",
"version": "0.0.1",
"description": "d8xz.com组件",
"scripts": {
"dev": "mip2 dev",
"build": "mip2 build",
"lint": "npm run lint:js",
"lint:js": "eslint --ext .vue,.js .",
"fix": "npm run fix:js",
"fix:js": "eslint --ext .vue,.js . --fix"
},
"author": "bingchuan",
"dependencies": {},
"devDependencies": {
"eslint": "^4.19.1",
"eslint-config-standard": "^11.0.0",
"eslint-plugin-import": "^2.12.0",
"eslint-plugin-jsdoc": "^3.7.1",
"eslint-plugin-node": "^6.0.1",
"eslint-plugin-promise": "^3.8.0",
"eslint-plugin-standard": "^3.1.0",
"eslint-plugin-vue": "^4.5.0"
}
}
Empty file added sites/d8xz.com/static/.gitkeep
Empty file.