Skip to content

Commit 0a63389

Browse files
committed
feat: add jsx list
1 parent bc63ccd commit 0a63389

File tree

8 files changed

+187
-4799
lines changed

8 files changed

+187
-4799
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,3 +104,5 @@ dist
104104

105105
# TernJS port file
106106
.tern-port
107+
108+
package-lock.json
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { createElement } from 'react';
2+
3+
function Foo() {
4+
return (
5+
<View>
6+
<View x-for={array}>hello</View>
7+
<View x-for={item in array}>item: {item}</View>
8+
<View x-for={(item, key) in foo}>key: {key}, item: {item}</View>
9+
<View x-for={(item, key) in exp()}>key: {key}, item: {item}</View>
10+
</View>
11+
)
12+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { createList as __create_list__ } from "babel-runtime-jsx-plus";
2+
import { createElement } from "react";
3+
function Foo() {
4+
return /*#__PURE__*/ React.createElement(View, null, __create_list__.call(this, array, function() {
5+
return React.createElement(View, null, "hello");
6+
}), __create_list__.call(this, array, function(item) {
7+
return React.createElement(View, null, "item: ", item);
8+
}), __create_list__.call(this, foo, function(item, key) {
9+
return React.createElement(View, null, "key: ", key, ", item: ", item);
10+
}), __create_list__.call(this, exp(), function(item, key) {
11+
return React.createElement(View, null, "key: ", key, ", item: ", item);
12+
}));
13+
}
14+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
const items = [1, 2, 3, 4];
2+
3+
export default function List() {
4+
return (
5+
<div>
6+
<div x-for={(it, idx) in items}>
7+
<span>{it}</span>
8+
</div>
9+
</div>
10+
);
11+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { createList as __create_list__ } from "babel-runtime-jsx-plus";
2+
var items = [
3+
1,
4+
2,
5+
3,
6+
4
7+
];
8+
export default function List() {
9+
return /*#__PURE__*/ React.createElement("div", null, __create_list__.call(this, items, function(it, idx) {
10+
return React.createElement("div", null, /*#__PURE__*/ React.createElement("span", null, it));
11+
}));
12+
};
13+

0 commit comments

Comments
 (0)