@mpxjs/webpack-plugin 2.9.67 → 2.9.70-alpha.0
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.
- package/README.md +1 -1
- package/lib/config.js +14 -0
- package/lib/dependencies/AddEntryDependency.js +24 -0
- package/lib/dependencies/ResolveDependency.js +5 -0
- package/lib/index.js +51 -15
- package/lib/json-compiler/helper.js +3 -3
- package/lib/loader.js +53 -0
- package/lib/platform/template/wx/component-config/button.js +14 -2
- package/lib/platform/template/wx/component-config/canvas.js +8 -0
- package/lib/platform/template/wx/component-config/image.js +4 -0
- package/lib/platform/template/wx/component-config/input.js +5 -1
- package/lib/platform/template/wx/component-config/rich-text.js +4 -0
- package/lib/platform/template/wx/component-config/scroll-view.js +4 -0
- package/lib/platform/template/wx/component-config/swiper.js +1 -1
- package/lib/platform/template/wx/component-config/switch.js +4 -0
- package/lib/platform/template/wx/component-config/text.js +4 -0
- package/lib/platform/template/wx/component-config/textarea.js +6 -1
- package/lib/platform/template/wx/component-config/unsupported.js +1 -1
- package/lib/platform/template/wx/component-config/view.js +4 -0
- package/lib/platform/template/wx/index.js +127 -1
- package/lib/react/processStyles.js +14 -4
- package/lib/react/processTemplate.js +3 -0
- package/lib/resolve-loader.js +4 -1
- package/lib/resolver/AddModePlugin.js +8 -8
- package/lib/runtime/components/react/context.ts +6 -0
- package/lib/runtime/components/react/dist/context.js +2 -0
- package/lib/runtime/components/react/dist/event.config.js +24 -24
- package/lib/runtime/components/react/dist/getInnerListeners.js +183 -174
- package/lib/runtime/components/react/dist/mpx-button.jsx +77 -49
- package/lib/runtime/components/react/dist/mpx-canvas/Bus.js +60 -0
- package/lib/runtime/components/react/dist/mpx-canvas/CanvasGradient.js +15 -0
- package/lib/runtime/components/react/dist/mpx-canvas/CanvasRenderingContext2D.js +84 -0
- package/lib/runtime/components/react/dist/mpx-canvas/Image.js +87 -0
- package/lib/runtime/components/react/dist/mpx-canvas/ImageData.js +15 -0
- package/lib/runtime/components/react/dist/mpx-canvas/constructorsRegistry.js +28 -0
- package/lib/runtime/components/react/dist/mpx-canvas/html.js +343 -0
- package/lib/runtime/components/react/dist/mpx-canvas/index.jsx +232 -0
- package/lib/runtime/components/react/dist/mpx-canvas/utils.jsx +89 -0
- package/lib/runtime/components/react/dist/mpx-checkbox-group.jsx +13 -19
- package/lib/runtime/components/react/dist/mpx-checkbox.jsx +29 -38
- package/lib/runtime/components/react/dist/mpx-form.jsx +16 -19
- package/lib/runtime/components/react/dist/mpx-icon.jsx +8 -16
- package/lib/runtime/components/react/dist/mpx-image.jsx +291 -0
- package/lib/runtime/components/react/dist/mpx-input.jsx +54 -27
- package/lib/runtime/components/react/dist/mpx-label.jsx +15 -22
- package/lib/runtime/components/react/dist/mpx-movable-area.jsx +13 -16
- package/lib/runtime/components/react/dist/mpx-movable-view.jsx +13 -13
- package/lib/runtime/components/react/dist/mpx-navigator.jsx +2 -4
- package/lib/runtime/components/react/dist/mpx-picker/date.jsx +6 -2
- package/lib/runtime/components/react/dist/mpx-picker/index.jsx +5 -3
- package/lib/runtime/components/react/dist/mpx-picker/multiSelector.jsx +6 -2
- package/lib/runtime/components/react/dist/mpx-picker/region.jsx +6 -2
- package/lib/runtime/components/react/dist/mpx-picker/selector.jsx +6 -2
- package/lib/runtime/components/react/dist/mpx-picker/time.jsx +10 -15
- package/lib/runtime/components/react/dist/mpx-picker-view-column-item.jsx +39 -0
- package/lib/runtime/components/react/dist/mpx-picker-view-column.jsx +160 -88
- package/lib/runtime/components/react/dist/mpx-picker-view.jsx +80 -121
- package/lib/runtime/components/react/dist/mpx-radio-group.jsx +11 -19
- package/lib/runtime/components/react/dist/mpx-radio.jsx +27 -42
- package/lib/runtime/components/react/dist/mpx-rich-text/html.js +39 -0
- package/lib/runtime/components/react/dist/mpx-rich-text/index.jsx +63 -0
- package/lib/runtime/components/react/dist/mpx-root-portal.jsx +6 -4
- package/lib/runtime/components/react/dist/mpx-scroll-view.jsx +47 -41
- package/lib/runtime/components/react/dist/mpx-simple-text.jsx +11 -0
- package/lib/runtime/components/react/dist/mpx-swiper-item.jsx +4 -2
- package/lib/runtime/components/react/dist/mpx-swiper.jsx +606 -0
- package/lib/runtime/components/react/dist/mpx-switch.jsx +20 -10
- package/lib/runtime/components/react/dist/mpx-text.jsx +11 -10
- package/lib/runtime/components/react/dist/mpx-textarea.jsx +8 -3
- package/lib/runtime/components/react/dist/mpx-view.jsx +65 -61
- package/lib/runtime/components/react/dist/mpx-web-view.jsx +112 -35
- package/lib/runtime/components/react/dist/pickerFaces.js +81 -0
- package/lib/runtime/components/react/dist/pickerVIewContext.js +9 -0
- package/lib/runtime/components/react/dist/pickerViewMask.jsx +18 -0
- package/lib/runtime/components/react/dist/pickerViewOverlay.jsx +23 -0
- package/lib/runtime/components/react/dist/useAnimationHooks.js +35 -9
- package/lib/runtime/components/react/dist/utils.jsx +70 -23
- package/lib/runtime/components/react/getInnerListeners.ts +36 -43
- package/lib/runtime/components/react/mpx-button.tsx +95 -43
- package/lib/runtime/components/react/mpx-canvas/Bus.ts +70 -0
- package/lib/runtime/components/react/mpx-canvas/CanvasGradient.ts +18 -0
- package/lib/runtime/components/react/mpx-canvas/CanvasRenderingContext2D.ts +87 -0
- package/lib/runtime/components/react/mpx-canvas/Image.ts +102 -0
- package/lib/runtime/components/react/mpx-canvas/ImageData.ts +23 -0
- package/lib/runtime/components/react/mpx-canvas/constructorsRegistry.ts +38 -0
- package/lib/runtime/components/react/mpx-canvas/html.ts +343 -0
- package/lib/runtime/components/react/mpx-canvas/index.tsx +302 -0
- package/lib/runtime/components/react/mpx-canvas/utils.tsx +150 -0
- package/lib/runtime/components/react/mpx-checkbox-group.tsx +13 -12
- package/lib/runtime/components/react/mpx-checkbox.tsx +28 -28
- package/lib/runtime/components/react/mpx-form.tsx +10 -8
- package/lib/runtime/components/react/mpx-icon.tsx +10 -15
- package/lib/runtime/components/react/mpx-image.tsx +396 -0
- package/lib/runtime/components/react/mpx-input.tsx +61 -33
- package/lib/runtime/components/react/mpx-label.tsx +14 -13
- package/lib/runtime/components/react/mpx-movable-area.tsx +8 -7
- package/lib/runtime/components/react/mpx-movable-view.tsx +1 -1
- package/lib/runtime/components/react/mpx-picker/date.tsx +5 -2
- package/lib/runtime/components/react/mpx-picker/index.tsx +3 -2
- package/lib/runtime/components/react/mpx-picker/multiSelector.tsx +5 -2
- package/lib/runtime/components/react/mpx-picker/region.tsx +5 -2
- package/lib/runtime/components/react/mpx-picker/selector.tsx +5 -2
- package/lib/runtime/components/react/mpx-picker/time.tsx +10 -15
- package/lib/runtime/components/react/mpx-picker/type.ts +48 -43
- package/lib/runtime/components/react/mpx-picker-view-column.tsx +236 -104
- package/lib/runtime/components/react/mpx-picker-view.tsx +132 -122
- package/lib/runtime/components/react/mpx-radio-group.tsx +11 -12
- package/lib/runtime/components/react/mpx-radio.tsx +26 -29
- package/lib/runtime/components/react/mpx-scroll-view.tsx +32 -30
- package/lib/runtime/components/react/mpx-simple-text.tsx +18 -0
- package/lib/runtime/components/react/mpx-swiper/carouse.tsx +4 -2
- package/lib/runtime/components/react/mpx-swiper-item.tsx +3 -2
- package/lib/runtime/components/react/mpx-switch.tsx +10 -8
- package/lib/runtime/components/react/mpx-text.tsx +6 -2
- package/lib/runtime/components/react/mpx-view.tsx +81 -59
- package/lib/runtime/components/react/mpx-web-view.tsx +46 -19
- package/lib/runtime/components/react/pickerFaces.ts +104 -0
- package/lib/runtime/components/react/pickerOverlay.tsx +32 -0
- package/lib/runtime/components/react/types/common.ts +2 -0
- package/lib/runtime/components/react/types/global.d.ts +3 -16
- package/lib/runtime/components/react/utils.tsx +98 -27
- package/lib/runtime/components/tenon/getInnerListeners.js +334 -0
- package/lib/runtime/components/tenon/tenon-button.vue +309 -0
- package/lib/runtime/components/tenon/tenon-image.vue +66 -0
- package/lib/runtime/components/tenon/tenon-input.vue +171 -0
- package/lib/runtime/components/tenon/tenon-rich-text.vue +26 -0
- package/lib/runtime/components/tenon/tenon-scroll-view.vue +127 -0
- package/lib/runtime/components/tenon/tenon-switch.vue +96 -0
- package/lib/runtime/components/tenon/tenon-text.vue +70 -0
- package/lib/runtime/components/tenon/tenon-textarea.vue +86 -0
- package/lib/runtime/components/tenon/tenon-view.vue +93 -0
- package/lib/runtime/components/web/getInnerListeners.js +6 -6
- package/lib/runtime/components/web/mpx-movable-view.vue +334 -344
- package/lib/runtime/components/web/mpx-picker-view-column.vue +75 -75
- package/lib/runtime/components/web/mpx-picker.vue +382 -385
- package/lib/runtime/components/web/mpx-web-view.vue +162 -162
- package/lib/runtime/optionProcessor.js +7 -16
- package/lib/runtime/optionProcessor.tenon.js +84 -0
- package/lib/runtime/utils.js +2 -0
- package/lib/style-compiler/index.js +1 -1
- package/lib/style-compiler/plugins/hm.js +20 -0
- package/lib/template-compiler/bind-this.js +7 -2
- package/lib/template-compiler/compiler.js +70 -42
- package/lib/template-compiler/gen-node-react.js +3 -3
- package/lib/tenon/index.js +117 -0
- package/lib/tenon/processJSON.js +352 -0
- package/lib/tenon/processScript.js +203 -0
- package/lib/tenon/processStyles.js +21 -0
- package/lib/tenon/processTemplate.js +126 -0
- package/lib/tenon/script-helper.js +223 -0
- package/lib/utils/env.js +6 -1
- package/lib/utils/get-relative-path.js +25 -0
- package/package.json +9 -4
- package/LICENSE +0 -433
- package/lib/runtime/components/react/dist/mpx-image/index.jsx +0 -226
- package/lib/runtime/components/react/dist/mpx-image/svg.jsx +0 -7
- package/lib/runtime/components/react/dist/mpx-swiper/carouse.jsx +0 -478
- package/lib/runtime/components/react/dist/mpx-swiper/index.jsx +0 -68
- package/lib/runtime/components/react/dist/mpx-swiper/type.js +0 -1
- package/lib/runtime/components/react/mpx-image/index.tsx +0 -345
- package/lib/runtime/components/react/mpx-image/svg.tsx +0 -22
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { getCustomEvent } from "./getInnerListeners";
|
|
3
|
+
import { h } from "@hummer/tenon-vue";
|
|
4
|
+
export default {
|
|
5
|
+
name: "mpx-switch",
|
|
6
|
+
props: {
|
|
7
|
+
name: String,
|
|
8
|
+
type: {
|
|
9
|
+
type: String,
|
|
10
|
+
default: "switch",
|
|
11
|
+
},
|
|
12
|
+
checked: {
|
|
13
|
+
type: Boolean,
|
|
14
|
+
default: false,
|
|
15
|
+
},
|
|
16
|
+
disabled: {
|
|
17
|
+
type: Boolean,
|
|
18
|
+
default: false,
|
|
19
|
+
},
|
|
20
|
+
color: {
|
|
21
|
+
type: String,
|
|
22
|
+
default: "#04BE02",
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
computed: {
|
|
26
|
+
originRef() {
|
|
27
|
+
return this.$refs["switch"]
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
watch: {
|
|
31
|
+
checked(newVal) {
|
|
32
|
+
this.switchChecked = newVal;
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
data() {
|
|
36
|
+
return {
|
|
37
|
+
switchChecked: this.checked,
|
|
38
|
+
};
|
|
39
|
+
},
|
|
40
|
+
render() {
|
|
41
|
+
let children = [];
|
|
42
|
+
|
|
43
|
+
const switchElem = h("switch", {
|
|
44
|
+
value: this.switchChecked,
|
|
45
|
+
class: [
|
|
46
|
+
"mpx-switch-label",
|
|
47
|
+
this.switchChecked ? "checked-switch-label" : "uncheck-switch-label",
|
|
48
|
+
],
|
|
49
|
+
});
|
|
50
|
+
children.push(switchElem);
|
|
51
|
+
|
|
52
|
+
// children.push(...(this.$slots.default() || []));
|
|
53
|
+
const data = {
|
|
54
|
+
class: ["mpx-switch-wrap"],
|
|
55
|
+
ref: "switch",
|
|
56
|
+
onClick: (e) => {
|
|
57
|
+
if (this.disabled) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
this.switchChecked = !this.switchChecked;
|
|
61
|
+
this.notifyChange();
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
return h("view", data, children);
|
|
65
|
+
},
|
|
66
|
+
methods: {
|
|
67
|
+
getValue() {
|
|
68
|
+
return this.switchChecked;
|
|
69
|
+
},
|
|
70
|
+
setValue(value) {
|
|
71
|
+
this.switchChecked = value;
|
|
72
|
+
},
|
|
73
|
+
notifyChange(value) {
|
|
74
|
+
if (value !== undefined) {
|
|
75
|
+
this.setValue(value);
|
|
76
|
+
} else {
|
|
77
|
+
value = this.getValue();
|
|
78
|
+
}
|
|
79
|
+
this.$emit(
|
|
80
|
+
"change",
|
|
81
|
+
getCustomEvent("change", { value }, this.$refs.switch)
|
|
82
|
+
);
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
</script>
|
|
87
|
+
|
|
88
|
+
<style lang="stylus" scoped>
|
|
89
|
+
.mpx-switch-wrap
|
|
90
|
+
.mpx-switch-label
|
|
91
|
+
border-radius 16hm
|
|
92
|
+
width 52hm
|
|
93
|
+
height 32hm
|
|
94
|
+
border none
|
|
95
|
+
|
|
96
|
+
</style>
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
|
|
2
|
+
<script>
|
|
3
|
+
import { h } from "@hummer/tenon-vue";
|
|
4
|
+
import getInnerListeners from "./getInnerListeners";
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
name: "mpx-text",
|
|
8
|
+
props: {
|
|
9
|
+
selectable: {
|
|
10
|
+
type: Boolean,
|
|
11
|
+
default: false,
|
|
12
|
+
},
|
|
13
|
+
space: {
|
|
14
|
+
type: String,
|
|
15
|
+
},
|
|
16
|
+
decode: {
|
|
17
|
+
type: Boolean,
|
|
18
|
+
default: false,
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
render() {
|
|
22
|
+
let text = "";
|
|
23
|
+
let classNames = ["mpx-text"];
|
|
24
|
+
const nodes = this.$slots.default && this.$slots.default() || []
|
|
25
|
+
nodes.forEach((item) => {
|
|
26
|
+
if (item.shapeFlag === 8 && item.children) {
|
|
27
|
+
text += item.children;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
// hummer不支持 暂时注释
|
|
31
|
+
// switch (this.space) {
|
|
32
|
+
// case "ensp":
|
|
33
|
+
// case "emsp":
|
|
34
|
+
// case "nbsp":
|
|
35
|
+
// text = text.replace(/ /g, `&${this.space};`);
|
|
36
|
+
// break;
|
|
37
|
+
// }
|
|
38
|
+
return h(
|
|
39
|
+
"text",
|
|
40
|
+
{
|
|
41
|
+
class: classNames,
|
|
42
|
+
ref: "mpx-text",
|
|
43
|
+
...getInnerListeners(this),
|
|
44
|
+
},
|
|
45
|
+
text
|
|
46
|
+
);
|
|
47
|
+
},
|
|
48
|
+
computed: {
|
|
49
|
+
originRef() {
|
|
50
|
+
return this.$refs["mpx-text"]
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
data() {
|
|
54
|
+
return {};
|
|
55
|
+
},
|
|
56
|
+
beforeCreate() {},
|
|
57
|
+
pageConfig: {
|
|
58
|
+
canScroll: false,
|
|
59
|
+
},
|
|
60
|
+
methods: {
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
</script>
|
|
64
|
+
<style lang="stylus" scoped>
|
|
65
|
+
.mpx-text
|
|
66
|
+
user-select none
|
|
67
|
+
&.selectable
|
|
68
|
+
user-select text
|
|
69
|
+
|
|
70
|
+
</style>
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
|
|
2
|
+
<script>
|
|
3
|
+
import { h } from "@hummer/tenon-vue";
|
|
4
|
+
import getInnerListeners from "./getInnerListeners";
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
name: "mpx-textarea",
|
|
8
|
+
props: {
|
|
9
|
+
name: String,
|
|
10
|
+
value: {
|
|
11
|
+
type: String,
|
|
12
|
+
default: "",
|
|
13
|
+
},
|
|
14
|
+
placeholder: String,
|
|
15
|
+
disabled: Boolean,
|
|
16
|
+
maxlength: {
|
|
17
|
+
type: Number,
|
|
18
|
+
default: 140,
|
|
19
|
+
},
|
|
20
|
+
autoFocus: Boolean,
|
|
21
|
+
focus: Boolean,
|
|
22
|
+
cursor: {
|
|
23
|
+
type: Number,
|
|
24
|
+
default: -1,
|
|
25
|
+
},
|
|
26
|
+
selectionStart: {
|
|
27
|
+
type: Number,
|
|
28
|
+
default: -1,
|
|
29
|
+
},
|
|
30
|
+
selectionEnd: {
|
|
31
|
+
type: Number,
|
|
32
|
+
default: -1,
|
|
33
|
+
},
|
|
34
|
+
placeholderStyle: {
|
|
35
|
+
type: String,
|
|
36
|
+
default: '',
|
|
37
|
+
},
|
|
38
|
+
confirmType: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: 'return',
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
computed: {
|
|
44
|
+
originRef() {
|
|
45
|
+
return this.$refs["mpx-textarea"]
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
watch: {
|
|
49
|
+
value: function(newVal, oldVal) {
|
|
50
|
+
if(this.originRef && newVal !== this.originRef.value){
|
|
51
|
+
this.originRef.value = newVal;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
render() {
|
|
57
|
+
const data = {
|
|
58
|
+
class: "mpx-textarea",
|
|
59
|
+
ref: "mpx-textarea",
|
|
60
|
+
focus: this.focus,
|
|
61
|
+
value: this.value,
|
|
62
|
+
placeholder: this.placeholder,
|
|
63
|
+
maxLength: this.maxlength,
|
|
64
|
+
disabled: this.disabled,
|
|
65
|
+
returnKeyType: this.confirmType,
|
|
66
|
+
...getInnerListeners(this),
|
|
67
|
+
};
|
|
68
|
+
return h("textarea", data);
|
|
69
|
+
},
|
|
70
|
+
pageConfig: {
|
|
71
|
+
canScroll: false,
|
|
72
|
+
},
|
|
73
|
+
methods: {},
|
|
74
|
+
};
|
|
75
|
+
</script>
|
|
76
|
+
<style lang="stylus" scoped>
|
|
77
|
+
.mpx-textarea
|
|
78
|
+
font inherit
|
|
79
|
+
cursor auto
|
|
80
|
+
width 300hm
|
|
81
|
+
height 150hm
|
|
82
|
+
display block
|
|
83
|
+
position relative
|
|
84
|
+
resize none
|
|
85
|
+
|
|
86
|
+
</style>
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { h } from "@hummer/tenon-vue";
|
|
3
|
+
import getInnerListeners from "./getInnerListeners";
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
name: "mpx-view",
|
|
7
|
+
props: {
|
|
8
|
+
hoverClass: {
|
|
9
|
+
type: String,
|
|
10
|
+
default: "none",
|
|
11
|
+
},
|
|
12
|
+
hoverStopPropagation: {
|
|
13
|
+
type: Boolean,
|
|
14
|
+
default: false,
|
|
15
|
+
},
|
|
16
|
+
hoverStartTime: {
|
|
17
|
+
type: Number,
|
|
18
|
+
default: 50,
|
|
19
|
+
},
|
|
20
|
+
hoverStayTime: {
|
|
21
|
+
type: Number,
|
|
22
|
+
default: 400,
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
render() {
|
|
26
|
+
let mergeAfter;
|
|
27
|
+
if (this.hoverClass && this.hoverClass !== "none") {
|
|
28
|
+
mergeAfter = {
|
|
29
|
+
listeners: {
|
|
30
|
+
onTouchstart: this.handleTouchstart,
|
|
31
|
+
onTouchend: this.handleTouchend,
|
|
32
|
+
},
|
|
33
|
+
force: true,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
return h(
|
|
37
|
+
"view",
|
|
38
|
+
{
|
|
39
|
+
class: this.className,
|
|
40
|
+
...getInnerListeners(this, { mergeAfter }),
|
|
41
|
+
ref: "mpx-view"
|
|
42
|
+
},
|
|
43
|
+
this.$slots.default && this.$slots.default() || ''
|
|
44
|
+
);
|
|
45
|
+
},
|
|
46
|
+
data() {
|
|
47
|
+
return {
|
|
48
|
+
hover: false,
|
|
49
|
+
};
|
|
50
|
+
},
|
|
51
|
+
computed: {
|
|
52
|
+
className() {
|
|
53
|
+
let result = {};
|
|
54
|
+
if (this.hoverClass && this.hoverClass !== "none" && this.hover) {
|
|
55
|
+
result = {
|
|
56
|
+
"mpx-view": true,
|
|
57
|
+
[this.hoverClass]: true,
|
|
58
|
+
};
|
|
59
|
+
} else {
|
|
60
|
+
result = {
|
|
61
|
+
"mpx-view": true,
|
|
62
|
+
[this.hoverClass]: false,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
return result;
|
|
66
|
+
},
|
|
67
|
+
originRef() {
|
|
68
|
+
return this.$refs["mpx-view"]
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
pageConfig: {
|
|
72
|
+
canScroll: false,
|
|
73
|
+
},
|
|
74
|
+
methods: {
|
|
75
|
+
handleTouchstart(e) {
|
|
76
|
+
if (e.__hoverStopPropagation) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
e.__hoverStopPropagation = this.hoverStopPropagation;
|
|
80
|
+
clearTimeout(this.startTimer);
|
|
81
|
+
this.startTimer = setTimeout(() => {
|
|
82
|
+
this.hover = true;
|
|
83
|
+
}, this.hoverStartTime);
|
|
84
|
+
},
|
|
85
|
+
handleTouchend() {
|
|
86
|
+
clearTimeout(this.endTimer);
|
|
87
|
+
this.endTimer = setTimeout(() => {
|
|
88
|
+
this.hover = false;
|
|
89
|
+
}, this.hoverStayTime);
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
</script>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { extend } from '../../utils'
|
|
1
2
|
function processModel (listeners, context) {
|
|
2
3
|
// 该函数只有wx:model的情况下才调用,而且默认e.detail.value有值
|
|
3
4
|
// 该函数必须在产生merge前执行
|
|
@@ -53,7 +54,7 @@ export function extendEvent (e, extendObj = {}) {
|
|
|
53
54
|
}
|
|
54
55
|
|
|
55
56
|
export function inheritEvent (type, oe, detail = {}) {
|
|
56
|
-
detail =
|
|
57
|
+
detail = extend({}, oe.detail, detail)
|
|
57
58
|
const ne = getCustomEvent(type, detail)
|
|
58
59
|
extendEvent(ne, {
|
|
59
60
|
timeStamp: oe.timeStamp,
|
|
@@ -68,12 +69,11 @@ export function inheritEvent (type, oe, detail = {}) {
|
|
|
68
69
|
export function getCustomEvent (type, detail = {}, target = null) {
|
|
69
70
|
const targetEl = (target && target.$el) || null
|
|
70
71
|
const targetInfo = targetEl ? { target: targetEl, currentTarget: targetEl } : {}
|
|
71
|
-
return {
|
|
72
|
+
return extend({
|
|
72
73
|
type,
|
|
73
74
|
detail,
|
|
74
|
-
timeStamp: new Date().valueOf()
|
|
75
|
-
|
|
76
|
-
}
|
|
75
|
+
timeStamp: new Date().valueOf()
|
|
76
|
+
}, targetInfo)
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
function noop () {
|
|
@@ -82,7 +82,7 @@ function noop () {
|
|
|
82
82
|
|
|
83
83
|
export default function getInnerListeners (context, options = {}) {
|
|
84
84
|
let { mergeBefore = {}, mergeAfter = {}, defaultListeners = [], ignoredListeners = [] } = options
|
|
85
|
-
const listeners =
|
|
85
|
+
const listeners = extend({}, context.$listeners)
|
|
86
86
|
defaultListeners.forEach((key) => {
|
|
87
87
|
if (!listeners[key]) listeners[key] = noop
|
|
88
88
|
})
|