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

开发360统计扩展插件 #1351

Open
wants to merge 1 commit 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
35 changes: 35 additions & 0 deletions src/mip-stats360/README.md
Original file line number Diff line number Diff line change
@@ -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
<mip-stats360 src="https://jspassport.ssl.qhimg.com/11.0.1.js?d182b3f28525f2db83acfaaf6e696dba" id="sozz"></mip-stats360>
```

## 属性

### src

说明:360统计接入script的src
必填:是
格式:字符串
单位:无
默认值: 无

### id

说明:360统计选填id参数
必填:否
格式:字符串
单位:无
默认值: 无
29 changes: 29 additions & 0 deletions src/mip-stats360/mip-stats360.js
Original file line number Diff line number Diff line change
@@ -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;

});
8 changes: 8 additions & 0 deletions src/mip-stats360/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "mip-stats360",
"version": "1.0.0",
"description":"mip-stats360 用于添加360统计到mip页面中",
"engines": {
"mip": ">=1.1.0"
}
}