Closed zhangzhenfei closed 5 years ago
麻烦提一下 app.tsx 代码
import '@tarojs/async-await'
import './app.scss'
import Taro, { Component, Config } from '@tarojs/taro'
import Index from './pages/index'
import { Provider } from '@tarojs/redux'
import config from './config'
import configStore from './store'
const store = configStore()
class App extends Component {
/**
* 指定config的类型声明为: Taro.Config
*
* 由于 typescript 对于 object 类型推导只能推出 Key 的基本类型
* 对于像 navigationBarTextStyle: 'black' 这样的推导出的类型是 string
* 提示和声明 navigationBarTextStyle: 'black' | 'white' 类型冲突, 需要显示声明类型
*/
config: Config = {
pages: ['pages/index/index', 'pages/profile/index'],
window: {
backgroundTextStyle: 'light',
navigationBarBackgroundColor: '#5DA374',
navigationBarTitleText: 'WeChat',
navigationBarTextStyle: 'white'
},
tabBar: {
color: '#5DA374',
selectedColor: '#5DA374',
borderStyle: 'white',
backgroundColor: '#FEFEFE',
list: [
{
text: '主页',
pagePath: 'pages/index/index',
iconPath: 'static/img/tabbar/homepage.png',
selectedIconPath: 'static/img/tabbar/homepage_fill.png'
},
{
text: '我的',
pagePath: 'pages/profile/index',
iconPath: 'static/img/tabbar/addressbook.png',
selectedIconPath: 'static/img/tabbar/addressbook_fill.png'
}
]
}
}
componentWillMount() {
/**
* 小程序初始化时执行,我们初始化客户端的登录地址,以支持所有的会话操作
*/
const qcloud = require('./vendor/wafer2-client-sdk/index')
qcloud.setLoginUrl(config.service.loginUrl)
}
componentDidMount() {}
componentDidShow() {}
componentDidHide() {}
componentCatchError() {}
componentDidCatchError() {}
// 在 App 类中的 render() 函数没有实际作用
// 请勿修改此函数
render() {
return (
<Provider store={store}>
<Index />
</Provider>
)
}
}
Taro.render(<App />, document.getElementById('app'))
@luckyadam
非常感谢,原来是因为开启了es6转es5引起的,不好意思~
非常感谢,原来是因为开启了es6转es5引起的,不好意思~
为啥开了es6转5会有这个问题鸭? 我没开还是有同样的错误。
我也是这个问题
我也是这个问题
xjb 删掉重新install 几次就好了
如果不开es6转 es5 引入vant组件库就会报错
问题描述 入口src/app.tsx已经引入
import '@tarojs/async-await'
page/index/index.tsx中使用async await 报错
期望行为 正常使用promise异步函数
报错信息
VM3610:1 thirdScriptError sdk uncaught third Error regeneratorRuntime is not defined ReferenceError: regeneratorRuntime is not defined at http://127.0.0.1:39581/appservice/pages/index/index.js:143:51 at http://127.0.0.1:39581/appservice/pages/index/index.js:170:6 at http://127.0.0.1:39581/appservice/pages/index/index.js:217:2 at require (http://127.0.0.1:39581/appservice/__dev__/WAService.js:1:701762) at:7:7
at HTMLScriptElement.scriptLoaded (http://127.0.0.1:39581/appservice/appservice?t=1541510408009:1172:23)
系统信息
补充信息