grid/grid-item组件在Taro项目中使用时,编译出现UnhandledPromiseRejectionWarning错误
jonahfang opened this issue · comments
Jonah Fang commented
错误信息如下:
(node:93506) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'isEmpty' of undefined
at Object.cleanRuleset (/Users/fzx/wxappdev/mywxapp/client/node_modules/csso/lib/clean/Rule.js:83:31)
at Object.leave (/Users/fzx/wxappdev/mywxapp/client/node_modules/csso/lib/clean/index.js:16:37)
at List.walkNode (/Users/fzx/wxappdev/mywxapp/client/node_modules/css-tree/lib/walker/create.js:161:19)
at List.each (/Users/fzx/wxappdev/mywxapp/client/node_modules/css-tree/lib/utils/list.js:159:12)
at Object.eval [as StyleSheet] (eval at createTypeIterator (/Users/fzx/wxappdev/mywxapp/client/node_modules/css-tree/lib/walker/create.js:112:12), <anonymous>:5:15)
at walkNode (/Users/fzx/wxappdev/mywxapp/client/node_modules/css-tree/lib/walker/create.js:158:37)
at walk (/Users/fzx/wxappdev/mywxapp/client/node_modules/css-tree/lib/walker/create.js:214:9)
at module.exports (/Users/fzx/wxappdev/mywxapp/client/node_modules/csso/lib/clean/index.js:13:5)
at compressChunk (/Users/fzx/wxappdev/mywxapp/client/node_modules/csso/lib/compress.js:68:5)
at compress (/Users/fzx/wxappdev/mywxapp/client/node_modules/csso/lib/compress.js:153:9)
(node:93506) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:93506) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code
Jonah Fang commented
Taro v1.3.25:
index.js
import Taro, { Component } from '@tarojs/taro'
import {Text,Block,View } from '@tarojs/components'
import iconList from './icon_list'
import './index.css'
export default class IndexPage extends Component {
config = {
navigationBarTitleText: '110.图标(tui-icon)',
usingComponents: {
'tui-icon': '../../../../thorui/icon/icon',
'tui-grid': '../../../../thorui/grid/grid',
'tui-grid-item': '../../../../thorui/grid-item/grid-item'
}
}
state = {}
render () {
return (
<View className="container">
<tui-grid>
{iconList.map((item)=>(
<Block key={item.name}>
<tui-grid-item>
<View className="tui-grid-icon">
<tui-icon name={item.name} size={item.size} color={item.color}></tui-icon>
</View>
<Text className="tui-grid-label" >{item.name}</Text>
</tui-grid-item>
</Block>
))}
</tui-grid>
</View>
)
}
}
//EOP
Jonah Fang commented
index.css:
.container {
padding-bottom: env(safe-area-inset-bottom);
}
.tui-grid-icon {
width: 64rpx;
height: 64rpx;
margin: 0 auto;
text-align: center;
vertical-align: middle;
}
.tui-grid-icon .tui-grid-label {
margin-top: 10rpx;
}
.tui-grid-label {
display: block;
text-align: center;
font-weight: 400;
color: #333;
font-size: 30rpx;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
Jonah Fang commented
用wux的grid代替tui-grid后编译正常。