From 8f2dea7922917fbe2f565f5738ef1ffc52c06633 Mon Sep 17 00:00:00 2001 From: yangmeng <82276964@qq.com> Date: Tue, 25 Feb 2020 16:07:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E5=8F=91360=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E6=89=A9=E5=B1=95=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mip-stats360/README.md | 35 ++++++++++++++++++++++++++++++++ src/mip-stats360/mip-stats360.js | 29 ++++++++++++++++++++++++++ src/mip-stats360/package.json | 8 ++++++++ 3 files changed, 72 insertions(+) create mode 100644 src/mip-stats360/README.md create mode 100644 src/mip-stats360/mip-stats360.js create mode 100644 src/mip-stats360/package.json 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