@mpxjs/webpack-plugin 2.9.70-alpha.0 → 2.9.71

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.
Files changed (126) hide show
  1. package/LICENSE +433 -0
  2. package/README.md +1 -1
  3. package/lib/config.js +0 -14
  4. package/lib/dependencies/ResolveDependency.js +0 -5
  5. package/lib/index.js +7 -38
  6. package/lib/json-compiler/helper.js +3 -3
  7. package/lib/loader.js +0 -53
  8. package/lib/parser.js +1 -1
  9. package/lib/platform/json/wx/index.js +21 -8
  10. package/lib/platform/style/wx/index.js +51 -54
  11. package/lib/platform/template/wx/component-config/button.js +2 -14
  12. package/lib/platform/template/wx/component-config/fix-component-name.js +15 -12
  13. package/lib/platform/template/wx/component-config/image.js +0 -4
  14. package/lib/platform/template/wx/component-config/index.js +1 -1
  15. package/lib/platform/template/wx/component-config/input.js +0 -4
  16. package/lib/platform/template/wx/component-config/movable-view.js +8 -1
  17. package/lib/platform/template/wx/component-config/picker-view.js +1 -5
  18. package/lib/platform/template/wx/component-config/rich-text.js +6 -2
  19. package/lib/platform/template/wx/component-config/scroll-view.js +1 -5
  20. package/lib/platform/template/wx/component-config/switch.js +0 -4
  21. package/lib/platform/template/wx/component-config/text.js +0 -4
  22. package/lib/platform/template/wx/component-config/textarea.js +0 -5
  23. package/lib/platform/template/wx/component-config/unsupported.js +1 -1
  24. package/lib/platform/template/wx/component-config/view.js +0 -4
  25. package/lib/platform/template/wx/index.js +1 -131
  26. package/lib/resolve-loader.js +1 -4
  27. package/lib/runtime/components/react/context.ts +8 -0
  28. package/lib/runtime/components/react/dist/context.js +2 -0
  29. package/lib/runtime/components/react/dist/getInnerListeners.js +39 -37
  30. package/lib/runtime/components/react/dist/mpx-button.jsx +16 -44
  31. package/lib/runtime/components/react/dist/mpx-canvas/html.js +2 -4
  32. package/lib/runtime/components/react/dist/mpx-canvas/index.jsx +5 -1
  33. package/lib/runtime/components/react/dist/mpx-movable-view.jsx +93 -58
  34. package/lib/runtime/components/react/dist/mpx-navigator.jsx +1 -1
  35. package/lib/runtime/components/react/dist/mpx-picker-view-column-item.jsx +10 -14
  36. package/lib/runtime/components/react/dist/mpx-picker-view-column.jsx +94 -81
  37. package/lib/runtime/components/react/dist/mpx-picker-view.jsx +19 -16
  38. package/lib/runtime/components/react/dist/mpx-rich-text/index.jsx +10 -11
  39. package/lib/runtime/components/react/dist/mpx-scroll-view.jsx +11 -4
  40. package/lib/runtime/components/react/dist/mpx-swiper-item.jsx +31 -8
  41. package/lib/runtime/components/react/dist/mpx-swiper.jsx +435 -371
  42. package/lib/runtime/components/react/dist/mpx-view.jsx +18 -53
  43. package/lib/runtime/components/react/dist/pickerFaces.js +3 -8
  44. package/lib/runtime/components/react/dist/pickerVIewContext.js +5 -0
  45. package/lib/runtime/components/react/dist/{pickerViewOverlay.jsx → pickerViewIndicator.jsx} +6 -6
  46. package/lib/runtime/components/react/dist/pickerViewMask.jsx +2 -2
  47. package/lib/runtime/components/react/dist/useAnimationHooks.js +27 -10
  48. package/lib/runtime/components/react/dist/utils.jsx +162 -70
  49. package/lib/runtime/components/react/event.config.ts +25 -26
  50. package/lib/runtime/components/react/getInnerListeners.ts +236 -182
  51. package/lib/runtime/components/react/mpx-button.tsx +27 -69
  52. package/lib/runtime/components/react/mpx-canvas/html.ts +2 -4
  53. package/lib/runtime/components/react/mpx-canvas/index.tsx +44 -46
  54. package/lib/runtime/components/react/mpx-checkbox-group.tsx +15 -13
  55. package/lib/runtime/components/react/mpx-checkbox.tsx +20 -21
  56. package/lib/runtime/components/react/mpx-form.tsx +15 -20
  57. package/lib/runtime/components/react/mpx-icon.tsx +2 -2
  58. package/lib/runtime/components/react/mpx-image.tsx +87 -47
  59. package/lib/runtime/components/react/mpx-input.tsx +24 -32
  60. package/lib/runtime/components/react/mpx-label.tsx +12 -14
  61. package/lib/runtime/components/react/mpx-movable-area.tsx +10 -16
  62. package/lib/runtime/components/react/mpx-movable-view.tsx +133 -92
  63. package/lib/runtime/components/react/mpx-navigator.tsx +3 -9
  64. package/lib/runtime/components/react/mpx-picker-view-column-item.tsx +76 -0
  65. package/lib/runtime/components/react/mpx-picker-view-column.tsx +206 -183
  66. package/lib/runtime/components/react/mpx-picker-view.tsx +49 -48
  67. package/lib/runtime/components/react/mpx-radio-group.tsx +13 -15
  68. package/lib/runtime/components/react/mpx-radio.tsx +19 -25
  69. package/lib/runtime/components/react/mpx-rich-text/html.ts +40 -0
  70. package/lib/runtime/components/react/mpx-rich-text/index.tsx +115 -0
  71. package/lib/runtime/components/react/mpx-root-portal.tsx +3 -5
  72. package/lib/runtime/components/react/mpx-scroll-view.tsx +53 -43
  73. package/lib/runtime/components/react/mpx-swiper-item.tsx +45 -11
  74. package/lib/runtime/components/react/mpx-swiper.tsx +742 -0
  75. package/lib/runtime/components/react/mpx-switch.tsx +19 -15
  76. package/lib/runtime/components/react/mpx-text.tsx +8 -16
  77. package/lib/runtime/components/react/mpx-textarea.tsx +11 -10
  78. package/lib/runtime/components/react/mpx-view.tsx +28 -77
  79. package/lib/runtime/components/react/mpx-web-view.tsx +94 -59
  80. package/lib/runtime/components/react/pickerFaces.ts +10 -7
  81. package/lib/runtime/components/react/pickerVIewContext.ts +27 -0
  82. package/lib/runtime/components/react/pickerViewIndicator.tsx +34 -0
  83. package/lib/runtime/components/react/pickerViewMask.tsx +30 -0
  84. package/lib/runtime/components/react/types/{getInnerListeners.ts → getInnerListeners.d.ts} +4 -5
  85. package/lib/runtime/components/react/types/global.d.ts +12 -1
  86. package/lib/runtime/components/react/useAnimationHooks.ts +60 -15
  87. package/lib/runtime/components/react/utils.tsx +175 -71
  88. package/lib/runtime/components/web/mpx-checkbox.vue +1 -1
  89. package/lib/runtime/components/web/mpx-picker-view-column.vue +9 -4
  90. package/lib/runtime/components/web/mpx-web-view.vue +34 -20
  91. package/lib/runtime/optionProcessor.js +0 -22
  92. package/lib/style-compiler/index.js +1 -1
  93. package/lib/style-compiler/plugins/scope-id.js +30 -2
  94. package/lib/template-compiler/compiler.js +91 -39
  95. package/lib/utils/env.js +1 -6
  96. package/lib/utils/pre-process-json.js +9 -5
  97. package/lib/wxss/loader.js +15 -2
  98. package/package.json +4 -7
  99. package/lib/dependencies/AddEntryDependency.js +0 -24
  100. package/lib/runtime/components/react/dist/types/common.js +0 -1
  101. package/lib/runtime/components/react/dist/types/getInnerListeners.js +0 -1
  102. package/lib/runtime/components/react/mpx-swiper/carouse.tsx +0 -527
  103. package/lib/runtime/components/react/mpx-swiper/index.tsx +0 -80
  104. package/lib/runtime/components/react/mpx-swiper/type.ts +0 -87
  105. package/lib/runtime/components/react/pickerOverlay.tsx +0 -32
  106. package/lib/runtime/components/tenon/getInnerListeners.js +0 -334
  107. package/lib/runtime/components/tenon/tenon-button.vue +0 -309
  108. package/lib/runtime/components/tenon/tenon-image.vue +0 -66
  109. package/lib/runtime/components/tenon/tenon-input.vue +0 -171
  110. package/lib/runtime/components/tenon/tenon-rich-text.vue +0 -26
  111. package/lib/runtime/components/tenon/tenon-scroll-view.vue +0 -127
  112. package/lib/runtime/components/tenon/tenon-switch.vue +0 -96
  113. package/lib/runtime/components/tenon/tenon-text.vue +0 -70
  114. package/lib/runtime/components/tenon/tenon-textarea.vue +0 -86
  115. package/lib/runtime/components/tenon/tenon-view.vue +0 -93
  116. package/lib/runtime/components/web/event.js +0 -105
  117. package/lib/runtime/optionProcessor.tenon.js +0 -84
  118. package/lib/style-compiler/plugins/hm.js +0 -20
  119. package/lib/tenon/index.js +0 -117
  120. package/lib/tenon/processJSON.js +0 -352
  121. package/lib/tenon/processScript.js +0 -203
  122. package/lib/tenon/processStyles.js +0 -21
  123. package/lib/tenon/processTemplate.js +0 -126
  124. package/lib/tenon/script-helper.js +0 -223
  125. package/lib/utils/get-relative-path.js +0 -25
  126. /package/lib/runtime/components/react/types/{common.ts → common.d.ts} +0 -0
@@ -1,66 +0,0 @@
1
- <script>
2
- import { h } from "@hummer/tenon-vue";
3
- import getInnerListeners from "./getInnerListeners";
4
-
5
- export default {
6
- name: "mpx-image",
7
- props: {
8
- src: {
9
- type: String,
10
- },
11
- mode: {
12
- type: String,
13
- default: "scaleToFill",
14
- },
15
- lazyLoad: {
16
- type: Boolean,
17
- default: false,
18
- },
19
- showMenuByLongpress: {
20
- type: Boolean,
21
- default: false,
22
- },
23
- },
24
- render() {
25
- let resize = "";
26
- switch (this.mode) {
27
- case "scaleToFill":
28
- resize = "stretch";
29
- break;
30
- case "aspectFit":
31
- resize = "contain";
32
- break;
33
- case "aspectFill":
34
- resize = "cover";
35
- break;
36
- default:
37
- resize = "stretch";
38
- }
39
- return h("image", {
40
- class: "mpx-image",
41
- ref: "mpx-image",
42
- src: this.src,
43
- resize,
44
- ...getInnerListeners(this)
45
- });
46
- },
47
- computed: {
48
- originRef() {
49
- return this.$refs["mpx-image"]
50
- }
51
- },
52
- data() {
53
- return {};
54
- },
55
- pageConfig: {
56
- canScroll: false,
57
- },
58
- methods: {
59
- },
60
- };
61
- </script>
62
- <style lang="stylus" scoped>
63
- .mpx-image
64
- width 300px
65
- height 225px
66
- </style>
@@ -1,171 +0,0 @@
1
- <script>
2
- import { h } from "@hummer/tenon-vue";
3
- import getInnerListeners from "./getInnerListeners";
4
- export default {
5
- name: "mpx-input",
6
- props: {
7
- name: String,
8
- value: {
9
- type: String,
10
- default: "",
11
- },
12
- type: {
13
- type: String,
14
- default: "text",
15
- },
16
- password: Boolean,
17
- placeholder: String,
18
- disabled: Boolean,
19
- maxlength: {
20
- type: Number,
21
- default: 140,
22
- },
23
- autoFocus: Boolean,
24
- focus: {
25
- type: Boolean,
26
- default: false,
27
- },
28
- cursor: {
29
- type: Number,
30
- default: -1,
31
- },
32
- selectionStart: {
33
- type: Number,
34
- default: -1,
35
- },
36
- selectionEnd: {
37
- type: Number,
38
- default: -1,
39
- },
40
- style: {
41
- type: String,
42
- default: '',
43
- },
44
- placeholderStyle: {
45
- type: String,
46
- default: '',
47
- },
48
- confirmType: {
49
- type: String,
50
- default: 'done',
51
- }
52
- },
53
- computed: {
54
- originRef() {
55
- return this.$refs["mpx-input"]
56
- },
57
- computedStyle() {
58
- let _inputWrapStyleObj = {
59
- "font-size": "33hm",
60
- height: "80hm",
61
- "line-height": "80hm",
62
- color: "#000000",
63
- border: "1hm solid #999999",
64
- "border-radius": "8hm",
65
- "text-align": "left",
66
- "background-color": "#ffffff"
67
- };
68
-
69
- if (typeof this.style !== 'string') {
70
- console.warn('Runtime warning: PROPS style must be string')
71
- }
72
-
73
- let _styleObj = {};
74
-
75
- if (typeof this.style === 'string') {
76
- let _style = this.style;
77
-
78
- if (_style[_style.length - 1] !== ";") {
79
- _style += ";";
80
- }
81
-
82
- _style.split(";").map(item => {
83
- if (item) {
84
- let itemArray = item.split(":");
85
- _styleObj[itemArray[0]] = itemArray[1];
86
- }
87
- });
88
- }
89
-
90
- //HACK: tenon会存在读到this.style为封装标签的样式 @曹恩泽
91
- if (typeof this.style === 'object') {
92
- _styleObj = Object.assign({}, _styleObj, this.style)
93
- }
94
-
95
- let styleObj = Object.assign({}, _inputWrapStyleObj, _styleObj);
96
- let style = Object.keys(styleObj)
97
- .map(k => `${k}:${styleObj[k]}`)
98
- .join(";");
99
-
100
- //Tenon变更placeholderColor
101
- const regex = /color/i
102
- style += this.placeholderStyle.replace(regex, 'placeholderColor');
103
- return style;
104
- },
105
- },
106
- watch: {
107
- value: function (newVal, oldVal) {
108
- console.log(newVal)
109
- if (this.originRef && newVal !== this.originRef.value) {
110
- this.originRef.value = newVal;
111
- }
112
- }
113
- },
114
- render() {
115
- let inputType = "";
116
- if (this.password) {
117
- inputType = "password";
118
- } else {
119
- switch (this.type) {
120
- case "text":
121
- inputType = "default";
122
- break;
123
- case "number":
124
- inputType = "number";
125
- break;
126
- case "tel":
127
- inputType = "tel";
128
- break;
129
- default:
130
- inputType = "text";
131
- }
132
- }
133
-
134
- const data = {
135
- class: "mpx-input",
136
- focused: this.focus,
137
- ref: "mpx-input",
138
- placeholder: this.placeholder,
139
- maxLength: this.maxlength,
140
- type: inputType,
141
- disabled: this.disabled,
142
- style: this.computedStyle,
143
- returnKeyType: this.confirmType,
144
- value: this.value,
145
- ...getInnerListeners(this, { _input: true }),
146
- };
147
- return h("input", data, []);
148
- },
149
- data() {
150
- return {};
151
- },
152
- pageConfig: {
153
- canScroll: false,
154
- },
155
- methods: {},
156
- };
157
- </script>
158
- <style lang="stylus" scoped>
159
- .mpx-input
160
- cursor auto
161
- width 100%
162
- padding 0
163
- border 0
164
- font inherit
165
- display block
166
- text-overflow clip
167
- overflow hidden
168
- white-space nowrap
169
- font-family UICTFontTextStyleBody
170
-
171
- </style>
@@ -1,26 +0,0 @@
1
- <script>
2
- import getInnerListeners from './getInnerListeners'
3
- import { h } from '@hummer/tenon-vue'
4
- export default {
5
- name: 'mpx-rich-text',
6
- props: {
7
- richText: {
8
- type: Object,
9
- value: {}
10
- }
11
- },
12
- computed: {
13
- originRef() {
14
- return this.$refs["mpx-richtext"]
15
- }
16
- },
17
- render () {
18
- const data = {
19
- richText: this.richText,
20
- ref: "mpx-richtext",
21
- ...getInnerListeners(this)
22
- }
23
- return h('text', data)
24
- }
25
- }
26
- </script>
@@ -1,127 +0,0 @@
1
- <script>
2
- import getInnerListeners from "./getInnerListeners";
3
- import { processSize } from '../../utils';
4
- import { h } from "@hummer/tenon-vue";
5
- export default {
6
- name: "mpx-scroll-view",
7
- props: {
8
- // 允许横向滚动
9
- scrollX: Boolean,
10
- // 允许纵向滚动
11
- scrollY: Boolean,
12
- // 滚动方向-默认竖向滚动
13
- scrollDirection: {
14
- type: String,
15
- default: "vertical",
16
- },
17
- // 距顶部/左边多远时,触发 scrolltoupper 事件
18
- upperThreshold: {
19
- type: [Number, String],
20
- default: 50,
21
- },
22
- // 距底部/右边多远时,触发 scrolltolower 事件
23
- lowerThreshold: {
24
- type: [Number, String],
25
- default: 50,
26
- },
27
- // 设置竖向滚动条位置
28
- scrollTop: {
29
- type: [Number, String],
30
- default: 0,
31
- },
32
- // 设置横向滚动条位置
33
- scrollLeft: {
34
- type: [Number, String],
35
- default: 0,
36
- },
37
- scrollOptions: Object,
38
- // 更新refresh
39
- updateRefresh: {
40
- type: Boolean,
41
- default: true,
42
- },
43
- // 值应为某子元素id(id不能以数字开头)。设置哪个方向可滚动,则在哪个方向滚动到该元素
44
- scrollIntoView: String,
45
- // 在设置滚动条位置时使用动画过渡
46
- scrollWithAnimation: Boolean,
47
- // 启用 flexbox 布局。开启后,当前节点声明了 display: flex 就会成为 flex container,并作用于其孩子节点。
48
- enableFlex: Boolean,
49
- // 启用 scroll-view 增强特性,启用后可通过 ScrollViewContext 操作 scroll-view
50
- enhanced: Boolean,
51
- // 开启自定义下拉刷新
52
- refresherEnabled: Boolean,
53
- // 设置当前下拉刷新状态,true 表示下拉刷新已经被触发,false 表示下拉刷新未被触发
54
- refresherTriggered: Boolean,
55
- // 设置自定义下拉刷新阈值
56
- refresherThreshold: {
57
- type: Number,
58
- default: 45,
59
- },
60
- // 设置自定义下拉刷新默认样式,支持设置 black | white | none, none 表示不使用默认样式
61
- refresherDefaultStyle: {
62
- type: String,
63
- default: "black",
64
- },
65
- // 设置自定义下拉刷新区域背景颜色
66
- refresherBackground: {
67
- type: String,
68
- default: "",
69
- },
70
- },
71
- data() {
72
- return {};
73
- },
74
- computed: {
75
- originRef() {
76
- return this.$refs["scroll"]
77
- },
78
- _scrollTop() {
79
- // return 1
80
- return processSize(this.scrollTop);
81
- },
82
- _scrollLeft() {
83
- // return 1
84
- return processSize(this.scrollLeft);
85
- },
86
- },
87
- mounted() {
88
- if (this.scrollTop) {
89
- setTimeout(() => {
90
- this.$refs.scroll && this.$refs.scroll.scrollTo(0, this._scrollTop);
91
- }, 100);
92
-
93
- }
94
- if (this.scrollLeft) {
95
- setTimeout(() => {
96
- this.$refs.scroll && this.$refs.scroll.scrollTo(this._scrollLeft, 0);
97
- }, 100);
98
- }
99
- },
100
- watch: {
101
- _scrollTop(val) {
102
- console.log('触发')
103
- this.$refs.scroll && this.$refs.scroll.scrollTo(0, val);
104
- },
105
- _scrollLeft(val) {
106
- this.$refs.scroll && this.$refs.scroll.scrollTo(val, 0);
107
- },
108
- },
109
- methods: {},
110
- render() {
111
- let scrollDirection = this.scrollDirection;
112
- if (!this.scrollY && this.scrollX) {
113
- scrollDirection = "horizontal";
114
- }
115
- return h(
116
- "scroller",
117
- {
118
- ref: "scroll",
119
- scrollDirection,
120
- showScrollBar: false,
121
- ...getInnerListeners(this, {})
122
- },
123
- this.$slots.default()
124
- );
125
- },
126
- };
127
- </script>
@@ -1,96 +0,0 @@
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>
@@ -1,70 +0,0 @@
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>
@@ -1,86 +0,0 @@
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>