diff --git a/mip-51la/README.md b/mip-51la/README.md new file mode 100644 index 00000000..efdf99b8 --- /dev/null +++ b/mip-51la/README.md @@ -0,0 +1,28 @@ +# mip-51la + +mip-51la 组件说明 + +标题|内容 +----|---- +类型|通用 +支持布局|responsive,fixed-height,fill,container,fixed +所需脚本|http://mipcache.bdstatic.com/static/v1/mip-51la/mip-51la.js + +## 示例 + +### 基本用法 +```html + + 自定义内容,可以嵌套其他组件 + +``` + +## 属性 + +### {sid} + +说明:{站点id} +必选项:{是} +类型:{数字} + + diff --git a/mip-51la/mip-51la.js b/mip-51la/mip-51la.js new file mode 100644 index 00000000..036150f6 --- /dev/null +++ b/mip-51la/mip-51la.js @@ -0,0 +1,23 @@ +/** + * @file mip-51la 组件 + * @author 点点 + */ + +define(function (require) { + + var customElement = require('customElement').create(); + + /** + * 构造元素,只会运行一次 + */ + customElement.prototype.createdCallback = function () { + // TODO + var e = this.element; + var s = e.getAttribute('sid'); + var d = document.createElement('script'); + d.src = 'https://js.users.51.la/' + s + '.js'; + e.appendChild(d); + }; + + return customElement; +}); diff --git a/mip-51la/package.json b/mip-51la/package.json new file mode 100644 index 00000000..9fcf4e7e --- /dev/null +++ b/mip-51la/package.json @@ -0,0 +1,14 @@ +{ + "name": "mip-51la", + "version": "1.0.0", + "description": "51la统计用", + "contributors": [ + { + "name": "点点", + "email": "sy3tem@qq.com" + } + ], + "engines": { + "mip": ">=1.1.0" + } +}