omip - fix this.data

This commit is contained in:
dntzhang 2019-03-01 10:55:07 +08:00
parent fcd21e345f
commit 79bef18b7c
2 changed files with 4 additions and 2 deletions

View File

@ -405,8 +405,8 @@ function hasComplexExpression(path) {
const parentPath = path.parentPath;
if (jsxElement &&
object.isThisExpression() &&
//不应该替换成 data导致 wxml 里的 this.data.a[1] 转换失败
property.isIdentifier({ name: 'state' }) &&
//@fix
property.isIdentifier({ name: 'data' }) &&
parentPath.isMemberExpression() &&
parentPath.parentPath.isMemberExpression()) {
const sourceCode = parentPath.parentPath.getSource();

View File

@ -17,6 +17,8 @@ export function define(name, ctor) {
}
})
config.data = ins._createData()
config.created = function () {
ins._weappRef = this
config.$$refs.forEach(ref => {