diff --git a/packages/omip-new/index.js b/packages/omip-new/index.js
index 1d8c0801d..86f6756b2 100644
--- a/packages/omip-new/index.js
+++ b/packages/omip-new/index.js
@@ -7,9 +7,10 @@ const code = `
import { render, h } from 'omis'
const Index = (props, store) => {
+ const abc =
return (
- {store.item.index}}: {store.item.msg}
+ {store.item.index}: {store.item.msg}
Time: {store.item.time}
)
@@ -37,6 +38,7 @@ const ast = parser.parse(code, {
});
console.log(ast)
+var jsxList =[]
traverse(ast, {
enter(path) {
if (path.isIdentifier({ name: "n" })) {
@@ -45,32 +47,16 @@ traverse(ast, {
},
JSXElement(p) {
//p.stop();
+ //change attributes
p.node.openingElement.attributes.push(t.jsxAttribute(t.JSXIdentifier('a'), t.StringLiteral('1')))
console.log(p)
- }
+ jsxList.push(p)
+ }
})
-console.log(generate(ast).code)
+//change tag name
+jsxList[0].node.openingElement.name.name = 'view'
+jsxList[0].node.closingElement.name.name = 'view'
+console.log(generate(jsxList[0].node).code)
-//输出
-// import { render, h } from 'omis';
-
-// const Index = (props, store) => {
-// return
-// {store.item.index}}: {store.item.msg}
-// Time: {store.item.time}
-// ;
-// };
-
-// Index.store = _ => {
-// return {
-// item: {
-// index: 0,
-// msg: 'this is a template',
-// time: '2016-09-15'
-// }
-// };
-// };
-
-// render(, 'body');
\ No newline at end of file