支持SSR、升级Vue版本和增加新的icon (#40)

* search component add new style

* update vue version and support ssr

* unit test

* add new icon

* new icon
This commit is contained in:
张敏
2017-06-15 19:46:56 +08:00
committed by Yao
parent 857da3a5ee
commit 0f5972e75e
59 changed files with 370 additions and 204 deletions

View File

@@ -1,3 +1,4 @@
import Vue from 'vue';
import { EventEmitter, extend, bindEvents, removeEvents } from './utils';
function Input(host, options) {
@@ -24,6 +25,7 @@ Input.prototype = Object.create(new EventEmitter());
extend(Input.prototype, {
bind: function(host) {
if (Vue.prototype.$isServer) return;
bindEvents(host, 'touchstart mousedown', this.onTouchStart);
if (this.options.listenMoving) {
bindEvents(window, 'touchmove mousemove', this.onTouchMove);
@@ -104,6 +106,7 @@ extend(Input.prototype, {
},
destroy: function() {
if (Vue.prototype.$isServer) return;
removeEvents(this.host, 'touchstart mousedown', this.onTouchStart);
if (this.options.listenMoving) {
removeEvents(window, 'touchmove mousemove', this.onTouchMove);

View File

@@ -4,8 +4,8 @@
<slot></slot>
</div>
<div class="van-swipe__indicators" v-if="showIndicators">
<span class="van-swipe__indicator" v-for="i in swipes.length" :class="{
'van-swipe__indicator--active': currIndex === i -1
<span class="van-swipe__indicator" v-for="(item, index) in swipes.length" :key="index" :class="{
'van-swipe__indicator--active': currIndex === index
}">
</span>
</div>

View File

@@ -1,4 +1,4 @@
'use strict';
import Vue from 'vue';
var extend = Object.assign.bind(Object);
@@ -37,17 +37,24 @@ EventEmitter.prototype = {
}
};
const requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame ||
window.webkitRequestAnimationFrame || window.msRequestAnimationFrame ||
function(callback, element) {
return window.setTimeout(callback, 1000 / 60);
};
const isSupportRequestAnimationFrame = !Vue.prototype.$isServer &&
(window.requestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.msRequestAnimationFrame);
const isSupportCancelAnimationFrame = !Vue.prototype.$isServer &&
(window.cancelAnimationFrame ||
window.mozCancelAnimationFrame ||
window.webkitCancelAnimationFrame ||
window.msCancelAnimationFrame);
const cancelAnimationFrame = window.cancelAnimationFrame || window.mozCancelAnimationFrame ||
window.webkitCancelAnimationFrame || window.msRequestAnimationFrame ||
function(id) {
clearTimeout(id);
};
const requestAnimationFrame = isSupportRequestAnimationFrame || function(callback, element) {
return window.setTimeout(callback, 1000 / 60);
};
const cancelAnimationFrame = isSupportCancelAnimationFrame || function(id) {
clearTimeout(id);
};
const bindEvents = (elem, eventNames, fn) => {
eventNames = eventNames.split(/\s+/);