Skip to content
This repository was archived by the owner on Jul 29, 2022. It is now read-only.

Commit c414881

Browse files
committed
Merge branch 'release/1.1.2'
2 parents f88f24a + 6003351 commit c414881

19 files changed

+51
-462
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
.idea
22
/node_modules
33
test/unit/coverage
4+
dist/

.npmignore

+2
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,6 @@ test/
1212
.gitignore
1313
.npmignore
1414
.npmrc
15+
.travis.yml
16+
circle.yml
1517
yarn.lock

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#### v1.0.7
2+
##### 1、修复全局无法引入bug

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import VueWow from 'vue-wow'
2727
Vue.use(VueWow)
2828

2929
// mount with component
30-
import {UAnimateContainer, UAnimate} from 'vue'
30+
import {UAnimateContainer, UAnimate} from 'vue-wow'
3131

3232
export default {
3333
components: {

build/webpack.dev.config.js

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ module.exports = merge(webpackBaseConfig, {
2323
resolve: {
2424
alias: {
2525
'vue-wow': path.resolve(ROOT_PATH, 'src/index')
26+
// 'vue-wow': path.resolve(ROOT_PATH, 'dist/vue-wow.min')
2627
}
2728
},
2829
plugins: [

circle.yml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
machine:
2+
node:
3+
version: 8

dist/vue-wow.js

-416
This file was deleted.

dist/vue-wow.min.js

-2
This file was deleted.

dist/vue-wow.min.js.gz

-4.52 KB
Binary file not shown.

dist/vue-wow.min.js.map

-1
This file was deleted.

docs/index.html

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
<html lang="zh-CN">
33
<head>
44
<meta charset="utf-8">
5-
<meta name="viewport" content="width=device-width, user-scalable=no">
5+
<meta name=viewport content="width=device-width,initial-scale=1,user-scalable=no,viewport-fit=cover">
6+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
67
<title>vue-wow</title>
78
</head>
89
<body>

docs/main.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/vendor.bundle.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/index.html

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
<html lang="zh-CN">
33
<head>
44
<meta charset="utf-8">
5-
<meta name="viewport" content="width=device-width, user-scalable=no">
5+
<meta name=viewport content="width=device-width,initial-scale=1,user-scalable=no,viewport-fit=cover">
6+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
67
<title>vue-wow</title>
78
</head>
89
<body>

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"name": "vue-wow",
3-
"version": "1.0.6",
3+
"version": "1.1.2",
44
"description": "VUE浏览器可视窗口加载",
5-
"main": "dist/vue-wow.js",
5+
"main": "dist/vue-wow.min.js",
66
"scripts": {
77
"lint": "eslint --ext .js,.vue src test/unit/specs",
8-
"dev": "webpack-dev-server --content-base test/ --open --inline --hot --compress --history-api-fallback --port 8080 --config build/webpack.dev.config.js",
8+
"dev": "webpack-dev-server --content-base test/ --open --inline --hot --compress --history-api-fallback --host 0.0.0.0 --port 8080 --config build/webpack.dev.config.js",
99
"docs": "webpack --config build/webpack.docs.config.js",
1010
"dist:dev": "webpack --config build/webpack.dist.dev.config.js",
1111
"dist:prd": "webpack --config build/webpack.dist.prd.config.js",

src/components/animate/index.vue

+4-2
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,10 @@
7878
}
7979
},
8080
resetAnimation (event) {
81-
this.removeVM(this)
82-
const {animateClass} = this
81+
try {
82+
this.removeVM(this)
83+
} catch (e) {
84+
}
8385
if (event.type.toLowerCase().indexOf('animationend') >= 0) {
8486
this.className = {}
8587
this.style = {}

src/components/container/index.vue

+21-4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
</template>
66
<script>
77
import {on, off} from 'utils/dom'
8+
import {isMobile} from 'utils/assist'
89
export default {
910
name: 'UAnimateContainer',
1011
props: {
@@ -23,6 +24,9 @@
2324
},
2425
data () {
2526
return {
27+
conf: Object.assign({}, {
28+
mobile: true
29+
}, this.config),
2630
all: [],
2731
vmArr: [],
2832
scrolled: false,
@@ -34,10 +38,13 @@
3438
},
3539
methods: {
3640
start () {
37-
const {vmArr} = this
38-
on(window, 'scroll', this.scrollHandler)
39-
on(window, 'resize', this.scrollHandler)
40-
this.interval = setInterval(this.scrollCallback, 50)
41+
if (!this.$isServer) {
42+
if (!this.disabled) {
43+
on(window, 'scroll', this.scrollHandler)
44+
on(window, 'resize', this.scrollHandler)
45+
this.interval = setInterval(this.scrollCallback, 50)
46+
}
47+
}
4148
},
4249
setVM (vm) {
4350
const index = this.all.findIndex(item => item._uid === vm._uid)
@@ -83,10 +90,20 @@
8390
}
8491
}
8592
},
93+
provide () {
94+
return {
95+
setVM: this.setVM,
96+
removeVM: this.removeVM,
97+
disabled: this.disabled
98+
}
99+
},
86100
destroyed () {
87101
this.stop()
88102
},
89103
computed: {
104+
disabled () {
105+
return !this.conf.mobile && isMobile()
106+
}
90107
}
91108
}
92109
</script>

src/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
import UAnimateContainer from 'components/container/index'
55
import UAnimate from 'components/animate/index'
66
function install (Vue) {
7-
Vue.components(UAnimateContainer.name, UAnimateContainer)
8-
Vue.components(UAnimate.name, UAnimate)
7+
Vue.component(UAnimateContainer.name, UAnimateContainer)
8+
Vue.component(UAnimate.name, UAnimate)
99
}
1010
if (typeof window !== 'undefined' && window.Vue) {
1111
install(window.Vue)

src/mixins/index.js

+5-27
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,17 @@ export default {
2828
},
2929
created () {
3030
if (!this.$isServer) {
31-
this.addVM()
31+
try {
32+
this.setVM(this)
33+
} catch (e) {
34+
}
3235
}
3336
},
3437
mounted () {
3538
this.start()
3639
},
40+
inject: ['setVM', 'removeVM', 'disabled'],
3741
methods: {
38-
addVM () {
39-
const {parent} = this
40-
parent && parent.setVM(this)
41-
},
42-
removeVM () {
43-
const {parent} = this
44-
parent && parent.removeVM(this)
45-
},
4642
start () {
4743
// 执行运动校验
4844
const {begin} = this
@@ -67,23 +63,5 @@ export default {
6763
if (!scrollListen) return false
6864
return isVisible(this.$el, offset)
6965
}
70-
},
71-
computed: {
72-
parent () {
73-
const {scrollListen} = this
74-
if (scrollListen) {
75-
let parent = this.$parent
76-
while (parent && parent.$options.name !== 'UAnimateContainer') {
77-
parent = parent.$parent
78-
}
79-
return parent
80-
} else {
81-
return undefined
82-
}
83-
},
84-
// 判断是否为手机
85-
disabled () {
86-
return isMobile()
87-
}
8866
}
8967
}

0 commit comments

Comments
 (0)