omip - fix nodeName

This commit is contained in:
dntzhang 2019-03-06 13:20:18 +08:00
parent 993b1f9140
commit efed5c371a
3 changed files with 19 additions and 2 deletions

BIN
assets/omi-logo-140.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

View File

@ -1,7 +1,10 @@
window.getApp = function () {
return {
globalData: {
userInfo: null
userInfo: {
avatarUrl: 'https://github.com/Tencent/omi/raw/master/assets/omi-logo-140.png?sanitize=true',
nickName: 'dntzhang(张磊)'
}
}
}
}

View File

@ -65,6 +65,20 @@ var stack = [];
var EMPTY_CHILDREN = [];
//
var mapTag = {
'view': 'div',
'picker': 'select',
'image': 'img',
'navigator': 'a',
'text': 'span'
}
var getNodeName = function(name){
if(mapTag[name]) return mapTag[name]
return name
}
/**
* JSX/hyperscript reviver.
* @see http://jasonformat.com/wtf-is-jsx
@ -131,7 +145,7 @@ function h(nodeName, attributes) {
}
var p = new VNode();
p.nodeName = nodeName;
p.nodeName = getNodeName(nodeName);
p.children = children;
p.attributes = attributes == null ? undefined : attributes;
p.key = attributes == null ? undefined : attributes.key;