Skip to content

Commit f965cda

Browse files
committed
add support for aliweex components.
1 parent 3d95654 commit f965cda

File tree

5 files changed

+37
-10
lines changed

5 files changed

+37
-10
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ const precompile = require('weex-vue-precompiler')(/*optional config*/)
4040
<!-- * `preservedTags`: the preserved weex components tag list. The default value is: `['a','container','div','image','img','text','input','switch','list','scroller','waterfall','slider','indicator','loading-indicator','loading','refresh','textarea','video','web']`. If you have other components as plugins installed in weex, you should add them to this lists, add pass the whole list to this. -->
4141
* `autoprefixer`: options for [autoprefixer](https://github.com/postcss/autoprefixer). default is { browsers: ['> 0.1%', 'ios >= 8', 'not ie < 12'] }.
4242
* `px2rem`: options for [postcss-plugin-px2rem](https://github.com/ant-tool/postcss-plugin-px2rem). default is: { rootValue: 75 }.
43+
* `aliweex`: boolean. default is false. Tell whether aliweex components are included in your project.
4344

4445
## feature
4546

package-lock.json

Lines changed: 16 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "weex-vue-precompiler",
3-
"version": "0.1.15",
3+
"version": "0.1.16",
44
"description": "a precompiler for weex-vue-render.",
55
"main": "src/index.js",
66
"scripts": {
@@ -17,7 +17,7 @@
1717
"autoprefixer": "^7.1.6",
1818
"escodegen": "^1.9.0",
1919
"esprima": "^4.0.0",
20-
"postcss": "^6.0.14",
20+
"postcss": "^6.0.16",
2121
"postcss-plugin-px2rem": "^0.7.0",
2222
"wxv-transformer": "^0.1.3"
2323
},

src/config.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@ const config = {
2222
'video',
2323
'web'
2424
],
25+
aliweexComponents: [
26+
// aliweex
27+
'tabheader',
28+
'mask',
29+
'richtext',
30+
'appbar',
31+
'parallax'
32+
],
2533
// these components should not bind events with .native.
2634
weexBuiltInComponents: [
2735
'div',

src/index.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,19 @@ class Precompiler {
3232

3333
const tag = identifyTag(el)
3434

35-
const { weexBuiltInComponents, weexRegisteredComponents } = this.config
35+
const {
36+
weexBuiltInComponents,
37+
weexRegisteredComponents,
38+
aliweex,
39+
aliweexComponents
40+
} = this.config
3641
if (weexBuiltInComponents.indexOf(el._origTag || el.tag) > -1) {
3742
el._weexBuiltIn = true
3843
}
39-
else if (weexRegisteredComponents.indexOf(el.tag) > -1) {
44+
else if (
45+
weexRegisteredComponents.indexOf(el.tag) > -1
46+
|| aliweex && aliweexComponents.indexOf(el.tag) > -1
47+
) {
4048
el._weexRegistered = true
4149
}
4250
else {

0 commit comments

Comments
 (0)