diff --git a/components/rate/demo/rate.vue b/components/rate/demo/rate.vue
new file mode 100644
index 000000000..31f3a2fe3
--- /dev/null
+++ b/components/rate/demo/rate.vue
@@ -0,0 +1,71 @@
+
+
+ 基本
+
+
+ 半星
+
+
+ 默认3颗星
+
+
改变
+
当前值
+
+ 只读
+
+
+ 回调函数
+
+
{{hoverValue}}stars
+
{{rValue}}stars
+
+
+
{{hoverValueAH}}stars
+
+ 自定义
+
+
+
+
diff --git a/components/util/util.js b/components/util/util.js
index 6d0070323..bef8da463 100644
--- a/components/util/util.js
+++ b/components/util/util.js
@@ -1,40 +1,39 @@
-function getScroll(w, top) {
- let ret = top ? w.pageYOffset : w.pageXOffset;
- const method = top ? 'scrollTop' : 'scrollLeft';
+function getScroll (w, top) {
+ let ret = top ? w.pageYOffset : w.pageXOffset
+ const method = top ? 'scrollTop' : 'scrollLeft'
if (typeof ret !== 'number') {
- const d = w.document;
+ const d = w.document
// ie6,7,8 standard mode
- ret = d.documentElement[method];
+ ret = d.documentElement[method]
if (typeof ret !== 'number') {
// quirks mode
- ret = d.body[method];
+ ret = d.body[method]
}
}
- return ret;
+ return ret
}
-function getClientPosition(elem) {
- let box;
- let x;
- let y;
- const doc = elem.ownerDocument;
- const body = doc.body;
- const docElem = doc && doc.documentElement;
- box = elem.getBoundingClientRect();
- x = box.left;
- y = box.top;
- x -= docElem.clientLeft || body.clientLeft || 0;
- y -= docElem.clientTop || body.clientTop || 0;
+function getClientPosition (elem) {
+ let x
+ let y
+ const doc = elem.ownerDocument
+ const body = doc.body
+ const docElem = doc && doc.documentElement
+ const box = elem.getBoundingClientRect()
+ x = box.left
+ y = box.top
+ x -= docElem.clientLeft || body.clientLeft || 0
+ y -= docElem.clientTop || body.clientTop || 0
return {
left: x,
top: y,
- };
+ }
}
export const getOffsetLeft = (el) => {
- const pos = getClientPosition(el);
- const doc = el.ownerDocument;
- const w = doc.defaultView || doc.parentWindow;
- pos.left += getScroll(w);
- return pos.left;
+ const pos = getClientPosition(el)
+ const doc = el.ownerDocument
+ const w = doc.defaultView || doc.parentWindow
+ pos.left += getScroll(w)
+ return pos.left
}