Skip to content

Commit

Permalink
update extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
mip-platform committed Jun 27, 2017
1 parent cab67f8 commit 6bb5300
Show file tree
Hide file tree
Showing 4 changed files with 122 additions and 0 deletions.
42 changes: 42 additions & 0 deletions mip-fn-comment-reply/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# mip-fn-comment-reply
<p>蜂鸟网WAP站评论回复</p>

## 示例
```html
<mip-fn-comment-reply class="reply_content mip-element mip-layout-container" replyid="877998" reply_path="877998," reply_userid="10515443" reply_username="爱德天空" on="tap:post-lightbox.open">
可以试试用这个调片,感谢分享
</mip-fn-comment-reply>
```

标题|内容
----|----
类型|通用
所需脚本|http://mipcache.bdstatic.com/static/v1/mip-fn-comment-reply/mip-fn-comment-reply.js

## 属性
### replyid
说明:回复评论所属id
必选项:是
类型:Number

### reply_path
说明: 回复的path
必选项:是
类型:Number

### reply_userid
说明:回复的userid
必选项:是
类型:字符串
取值范围:Number

### reply_username
说明:回复的username
必选项:是
类型:字符串






62 changes: 62 additions & 0 deletions mip-fn-comment-reply/mip-fn-comment-reply.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/**
* @file mip-fn-reply 组件
* @author wangyan
*/
define(function (require) {
var zepto = require('zepto');
var customElem = require('customElement').create();

// 生命周期 function list,根据组件情况选用,(一般情况选用 build、firstInviewCallback) start
// build 方法,元素插入到文档时执行,仅会执行一次
customElem.prototype.build = function () {
// this.element 可取到当前实例对应的 dom 元素
var element = this.element;
var replyid = element.getAttribute('replyid');
var replyPath = element.getAttribute('reply_path');
var replyUserid = element.getAttribute('reply_userid');
var replyUsername = element.getAttribute('reply_username');

element.addEventListener('touchstart', function () {
var obj = document.getElementById('content');
obj.setAttribute('replyid', replyid);
obj.setAttribute('reply_path', replyPath);
obj.setAttribute('reply_userid', replyUserid);
obj.setAttribute('reply_username', replyUsername);
obj.value = '回复@' + replyUsername + ':';
}, false);

};

// 创建元素回调
customElem.prototype.createdCallback = function () {
// console.log('created');
};
// 向文档中插入节点回调
customElem.prototype.attachedCallback = function () {
// console.log('attached');
};
// 从文档中移出节点回调
customElem.prototype.detachedCallback = function () {
// console.log('detached');
};
// 第一次进入可视区回调,只会执行一次,做懒加载,利于网页速度
customElem.prototype.firstInviewCallback = function () {
// console.log('first in viewport');
};
// 进入或离开可视区回调,每次状态变化都会执行
customElem.prototype.viewportCallback = function (isInView) {
// true 进入可视区;false 离开可视区
// console.log(isInView);
};
// 控制viewportCallback、firstInviewCallback是否提前执行
// 轮播图片等可使用此方法提前渲染
customElem.prototype.prerenderAllowed = function () {
// 判断条件,可自定义。返回值为true时,viewportCallback、firstInviewCallback会在元素build后执行
return !!this.isCarouselImg;
};
// 生命周期 function list,根据组件情况选用 end


return customElem;
});

6 changes: 6 additions & 0 deletions mip-fn-comment-reply/mip-fn-comment-reply.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
mip-fn-comment-reply{
font-size: 0.65rem;
line-height: 1.0rem;
word-wrap: break-word;
word-break: break-all;
}
12 changes: 12 additions & 0 deletions mip-fn-comment-reply/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "mip-fn-comment-reply",
"version": "1.0.0",
"description": "蜂鸟网WAP站评论回复",
"author": {
"name": "fn",
"email": "[email protected]"
},
"engines": {
"mip": ">=1.1.0"
}
}

0 comments on commit 6bb5300

Please sign in to comment.