diff --git a/src/mip-stats360/README.md b/src/mip-stats360/README.md new file mode 100644 index 000000000..a9391a3a4 --- /dev/null +++ b/src/mip-stats360/README.md @@ -0,0 +1,35 @@ +# mip-stats360 360统计 + +添加360统计。 + +标题|内容 +----|---- +类型|定制 +支持布局|responsive, fixed-height, fill, container, fixed +所需脚本|https://c.mipcdn.com/static/v1/mip-stats360/mip-stats360.js + +## 示例 + +自定义接入360统计插件,便于站长更好的接入 MIP + +```html + +``` + +## 属性 + +### src + +说明:360统计接入script的src +必填:是 +格式:字符串 +单位:无 +默认值: 无 + +### id + +说明:360统计选填id参数 +必填:否 +格式:字符串 +单位:无 +默认值: 无 diff --git a/src/mip-stats360/mip-stats360.js b/src/mip-stats360/mip-stats360.js new file mode 100644 index 000000000..d5223ea5e --- /dev/null +++ b/src/mip-stats360/mip-stats360.js @@ -0,0 +1,29 @@ +/** + * @file 360统计 + * + * @author suruto + */ + +define(function (require) { + var customElement = require('customElement').create(); + var util = require('util'); + + customElement.prototype.build = function () { + var _this = this; + + util.css(_this.element, 'display', 'none'); + + // 获取节点数据,默认以原来数据提交 + var src = _this.element.getAttribute('src') || 'https://jspassport.ssl.qhimg.com/11.0.1.js?d182b3f28525f2db83acfaaf6e696dba'; + var id = _this.element.getAttribute('id') || 'sozz'; + + var node = document.createElement('script'); + node.type = 'text/javascript'; + node.src = src; + node.id = id; + node.async = true; + _this.element.appendChild(node); + } + return customElement; + +}); \ No newline at end of file diff --git a/src/mip-stats360/package.json b/src/mip-stats360/package.json new file mode 100644 index 000000000..47ccafa45 --- /dev/null +++ b/src/mip-stats360/package.json @@ -0,0 +1,8 @@ +{ + "name": "mip-stats360", + "version": "1.0.0", + "description":"mip-stats360 用于添加360统计到mip页面中", + "engines": { + "mip": ">=1.1.0" + } +} \ No newline at end of file