omip - fix build error
This commit is contained in:
parent
b803b5f074
commit
ff8f1c9ff6
|
@ -1,6 +1,6 @@
|
|||
button {
|
||||
width: 200px;
|
||||
height: 80px;
|
||||
line-height: 80px;
|
||||
width: 100px;
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
display: inline-block;
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
import { WeElement, define } from 'omi'
|
||||
//import '../my-element'
|
||||
import '../my-element'
|
||||
|
||||
//兼容 omi 下划线?
|
||||
import './index.css'
|
||||
|
@ -30,7 +30,7 @@ define('my-counter', class extends WeElement {
|
|||
<button onClick={this.sub}>-</button>
|
||||
<text>{this.data.count}</text>
|
||||
<button onClick={this.add}>+</button>
|
||||
{/* <my-element msg='omi'></my-element> */}
|
||||
<my-element msg='omi'></my-element>
|
||||
</view>
|
||||
)
|
||||
}
|
||||
|
|
|
@ -22,10 +22,10 @@ export function define(name, ctor) {
|
|||
}
|
||||
|
||||
config.$usedState && config.$usedState.forEach(prop => {
|
||||
if(config.data && !config.data.hasOwnProperty(prop)){
|
||||
if(!config.data || (config.data && !config.data.hasOwnProperty(prop))){
|
||||
config.properties[prop] = null
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
Component(config)
|
||||
}
|
||||
|
|
|
@ -768,7 +768,7 @@ function parseAst (type, ast, depComponents, sourceFilePath, filePath, npmSkip =
|
|||
//node.body.push(template(`Taro.initPxTransform(${JSON.stringify(pxTransformConfig)})`, babylonConfig)())
|
||||
//@fix Please do not call Page constructor in files that not listed in "pages" section of app.json or plugin.json
|
||||
node.body.forEach((item, index) => {
|
||||
if (item.type === 'ImportDeclaration' && item.source.value.indexOf('./pages/') === 0) {
|
||||
if (item.type === 'ImportDeclaration' && item.source.value.indexOf('./pages/') === 0 && node.body[index].specifiers.length === 0) {
|
||||
node.body[index] = null
|
||||
}
|
||||
})
|
||||
|
@ -790,6 +790,16 @@ function parseAst (type, ast, depComponents, sourceFilePath, filePath, npmSkip =
|
|||
}
|
||||
break
|
||||
case PARSE_AST_TYPE.COMPONENT:
|
||||
|
||||
node.body.forEach((item, index) => {
|
||||
if (item.type === 'ImportDeclaration') {
|
||||
const v = node.body[index].source.value
|
||||
if (v.indexOf('libs/taro/') === -1 && v.indexOf('libs/omip/') === -1 && node.body[index].specifiers.length === 0) {
|
||||
node.body[index] = null
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
//@fix 注释掉用来解决小程序报错
|
||||
//node.body.push(template(`Component(require('${taroMiniAppFrameworkPath}').default.createComponent(${exportVariableName}))`, babylonConfig)())
|
||||
break
|
||||
|
|
Loading…
Reference in New Issue