@mpxjs/webpack-plugin 2.6.111 → 2.6.112
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -36,7 +36,8 @@
|
|
|
36
36
|
easingFunction: {
|
|
37
37
|
type: String,
|
|
38
38
|
default: 'default'
|
|
39
|
-
}
|
|
39
|
+
},
|
|
40
|
+
scrollOptions: Object
|
|
40
41
|
},
|
|
41
42
|
data () {
|
|
42
43
|
return {
|
|
@@ -90,11 +91,21 @@
|
|
|
90
91
|
this.goto(val)
|
|
91
92
|
}
|
|
92
93
|
},
|
|
94
|
+
activated () {
|
|
95
|
+
if (this.bs && this.autoplay) {
|
|
96
|
+
this.bs.startPlay()
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
deactivated () {
|
|
100
|
+
if (this.bs && this.autoplay) {
|
|
101
|
+
this.bs.pausePlay()
|
|
102
|
+
}
|
|
103
|
+
},
|
|
93
104
|
beforeCreate () {
|
|
94
105
|
this.itemIds = []
|
|
95
106
|
},
|
|
96
107
|
mounted () {
|
|
97
|
-
|
|
108
|
+
const originBsOptions = {
|
|
98
109
|
scrollX: !this.vertical,
|
|
99
110
|
scrollY: this.vertical,
|
|
100
111
|
slide: {
|
|
@@ -103,14 +114,17 @@
|
|
|
103
114
|
speed: this.duration,
|
|
104
115
|
easing: this.easing,
|
|
105
116
|
interval: this.interval,
|
|
106
|
-
autoplay: this.autoplay
|
|
117
|
+
autoplay: this.autoplay,
|
|
118
|
+
startPageXIndex: this.vertical ? 0 : this.current,
|
|
119
|
+
startPageYIndex: this.vertical? this.current : 0
|
|
107
120
|
},
|
|
108
121
|
momentum: false,
|
|
109
122
|
bounce: false,
|
|
110
123
|
probeType: 3,
|
|
111
124
|
stopPropagation: true
|
|
112
|
-
}
|
|
113
|
-
|
|
125
|
+
}
|
|
126
|
+
const bsOptions = Object.assign({}, originBsOptions, this.scrollOptions)
|
|
127
|
+
this.bs = new BScroll(this.$refs.wrapper, bsOptions)
|
|
114
128
|
this.bs.on('slideWillChange', (page) => {
|
|
115
129
|
this.currentIndex = this.vertical ? page.pageY : page.pageX
|
|
116
130
|
this.$emit('change', getCustomEvent('change', {
|
|
@@ -29,6 +29,7 @@ module.exports = function (css, map) {
|
|
|
29
29
|
|
|
30
30
|
const transRpxRules = transRpxRulesRaw ? (Array.isArray(transRpxRulesRaw) ? transRpxRulesRaw : [transRpxRulesRaw]) : []
|
|
31
31
|
|
|
32
|
+
const transRpxFn = mpx.webConfig.transRpxFn
|
|
32
33
|
const testResolveRange = (include = () => true, exclude) => {
|
|
33
34
|
return matchCondition(this.resourcePath, { include, exclude })
|
|
34
35
|
}
|
|
@@ -75,7 +76,7 @@ module.exports = function (css, map) {
|
|
|
75
76
|
}
|
|
76
77
|
|
|
77
78
|
if (mpx.mode === 'web') {
|
|
78
|
-
plugins.push(vw)
|
|
79
|
+
plugins.push(vw({ transRpxFn }))
|
|
79
80
|
}
|
|
80
81
|
// source map
|
|
81
82
|
if (this.sourceMap && !options.map) {
|
|
@@ -5,12 +5,13 @@ const rpxRegExpG = /\b(\d+(\.\d+)?)rpx\b/g
|
|
|
5
5
|
module.exports = postcss.plugin('vw', (options = {}) => root => {
|
|
6
6
|
const rpx2vwRatio = +(100 / 750).toFixed(8)
|
|
7
7
|
|
|
8
|
+
const transRpxFn = options.transRpxFn && typeof options.transRpxFn === 'function' ? options.transRpxFn : function (match, $1) {
|
|
9
|
+
if ($1 === '0') return $1
|
|
10
|
+
return `${$1 * rpx2vwRatio}vw`
|
|
11
|
+
}
|
|
8
12
|
function transVw (declaration) {
|
|
9
13
|
if (rpxRegExp.test(declaration.value)) {
|
|
10
|
-
declaration.value = declaration.value.replace(rpxRegExpG,
|
|
11
|
-
if ($1 === '0') return $1
|
|
12
|
-
return `${$1 * rpx2vwRatio}vw`
|
|
13
|
-
})
|
|
14
|
+
declaration.value = declaration.value.replace(rpxRegExpG, transRpxFn)
|
|
14
15
|
}
|
|
15
16
|
}
|
|
16
17
|
|
|
@@ -40,11 +40,16 @@ module.exports = function (content) {
|
|
|
40
40
|
let results = targetPath.unshiftContainer('body', insertNodes) || []
|
|
41
41
|
targetPath.inserted = true
|
|
42
42
|
results.forEach((item) => {
|
|
43
|
-
item.
|
|
43
|
+
item.shouldStopTraverse = true
|
|
44
44
|
})
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
},
|
|
48
|
+
ForStatement (path) {
|
|
49
|
+
if (path.shouldStopTraverse) {
|
|
50
|
+
path.stop()
|
|
51
|
+
}
|
|
52
|
+
},
|
|
48
53
|
// 处理vant-aliapp中export var bem = bem;这种不被acorn支持的2b语法
|
|
49
54
|
ExportNamedDeclaration (path) {
|
|
50
55
|
if (
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mpxjs/webpack-plugin",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.112",
|
|
4
4
|
"description": "mpx compile core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mpx"
|
|
@@ -81,5 +81,5 @@
|
|
|
81
81
|
"@types/babel-traverse": "^6.25.4",
|
|
82
82
|
"@types/babel-types": "^7.0.4"
|
|
83
83
|
},
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "961b7a70cba62f8192ecf6b4007a0d7a9c52f97e"
|
|
85
85
|
}
|