Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

用Taro开发头条小程序,使用dva框架报错:Object属性未定义 #3776

Closed
guaiguaimao opened this issue Jul 11, 2019 · 5 comments
Closed
Assignees

Comments

@guaiguaimao
Copy link

No description provided.

@taro-bot
Copy link

taro-bot bot commented Jul 11, 2019

欢迎提交 Issue~

如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏

如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。

Good luck and happy coding~

@Chen-jj
Copy link
Contributor

Chen-jj commented Jul 11, 2019

@guaiguaimao 请提供版本号 + 报错截图 + demo

@guaiguaimao
Copy link
Author

app.js文件:
import '@tarojs/async-await'
import {Provider} from '@tarojs/redux'
import Taro, { Component } from '@tarojs/taro'
import Index from './pages/index'
import dva from './dva'
import models from './model'

import './app.scss'

const dvaApp = dva.createApp({
initialState: {},
models: models,
onError() {
},
});

const store = dvaApp.getStore();
global.dvaStore = store

class App extends Component {

config = {
pages: [
'pages/index/index',
],
window: {
backgroundTextStyle: 'light',
navigationBarBackgroundColor: '#fff',
navigationBarTitleText: 'xxx',
navigationBarTextStyle: 'black'
},
}
componentWillMount () {
}
componentDidShow () {
}
componentDidHide () { }
componentDidMount () {
}
componentDidHide () {}
componentCatchError () {}
render () {
return (

)
}
}

Taro.render(, document.getElementById('app'))
dva文件:
import {create} from 'dva-core';
// import {createLogger} from 'redux-logger';
import createLoading from 'dva-loading';

let app;
let store;
let dispatch;

function createApp(opt) {
// opt.onAction = [createLogger()];
app = create(opt);
app.use(createLoading({}));

if (!global.registered) opt.models.forEach(model => app.model(model));
global.registered = true;
app.start();

store = app._store;
app.getStore = () => store;

dispatch = store.dispatch;

app.dispatch = dispatch;
return app;
}

export default {
createApp,
getDispatch() {
return app.dispatch;
}
}
版本号:
"@tarojs/async-await": "^1.3.8",
"@tarojs/components": "1.3.8",
"@tarojs/redux": "^1.2.0-beta.6",
"@tarojs/router": "1.3.8",
"@tarojs/taro": "1.3.8",
"@tarojs/taro-alipay": "1.3.8",
"@tarojs/taro-h5": "1.3.8",
"@tarojs/taro-swan": "1.3.8",
"@tarojs/taro-tt": "1.3.8",
"@tarojs/taro-weapp": "1.3.8",
"back-mock": "^1.0.5",
"dva-core": "^1.4.0",
"dva-loading": "^2.0.6",
"hjdshu-mini-utils": "^1.0.6",
"nervjs": "^1.3.9",
"react-redux": "^5.1.1",
"redux": "^4.0.1",
"redux-logger": "^3.0.6",
"redux-thunk": "^2.3.0"
运行后报错:
_export.js:17 Uncaught TypeError: Cannot read property 'Object' of undefined
at $export (eval at window.loadScript (/Applications/bytedanceide.app/Contents/Resources/app.asar.unpacked/simulator-sdk/temFiles/dist/preload/bgPreload.js:164), :20:55)
at module.exports (eval at window.loadScript (/Applications/bytedanceide.app/Contents/Resources/app.asar.unpacked/simulator-sdk/temFiles/dist/preload/bgPreload.js:164), :12:3)
at eval (eval at window.loadScript (/Applications/bytedanceide.app/Contents/Resources/app.asar.unpacked/simulator-sdk/temFiles/dist/preload/bgPreload.js:164), :8:28)
at f (eval at window.loadTmaScript (/Applications/bytedanceide.app/Contents/Resources/app.asar.unpacked/simulator-sdk/temFiles/dist/preload/bgPreload.js:164), :1:1537)
at eval (eval at window.loadTmaScript (/Applications/bytedanceide.app/Contents/Resources/app.asar.unpacked/simulator-sdk/temFiles/dist/preload/bgPreload.js:164), :1:158760)
at eval (eval at window.loadScript (/Applications/bytedanceide.app/Contents/Resources/app.asar.unpacked/simulator-sdk/temFiles/dist/preload/bgPreload.js:164), :4:1)
at f (eval at window.loadTmaScript (/Applications/bytedanceide.app/Contents/Resources/app.asar.unpacked/simulator-sdk/temFiles/dist/preload/bgPreload.js:164), :1:1537)
at eval (eval at window.loadTmaScript (/Applications/bytedanceide.app/Contents/Resources/app.asar.unpacked/simulator-sdk/temFiles/dist/preload/bgPreload.js:164), :1:158760)
at eval (eval at window.loadScript (/Applications/bytedanceide.app/Contents/Resources/app.asar.unpacked/simulator-sdk/temFiles/dist/preload/bgPreload.js:164), :4:18)
at f (eval at window.loadTmaScript (/Applications/bytedanceide.app/Contents/Resources/app.asar.unpacked/simulator-sdk/temFiles/dist/preload/bgPreload.js:164), :1:1537)
at eval (eval at window.loadTmaScript (/Applications/bytedanceide.app/Contents/Resources/app.asar.unpacked/simulator-sdk/temFiles/dist/preload/bgPreload.js:164), :1:158760)
at eval (eval at window.loadScript (/Applications/bytedanceide.app/Contents/Resources/app.asar.unpacked/simulator-sdk/temFiles/dist/preload/bgPreload.js:164), :4:40)
at f (eval at window.loadTmaScript (/Applications/bytedanceide.app/Contents/Resources/app.asar.unpacked/simulator-sdk/temFiles/dist/preload/bgPreload.js:164), :1:1537)
at eval (eval at window.loadTmaScript (/Applications/bytedanceide.app/Contents/Resources/app.asar.unpacked/simulator-sdk/temFiles/dist/preload/bgPreload.js:164), :1:158760)
at eval (eval at window.loadScript (/Applications/bytedanceide.app/Contents/Resources/app.asar.unpacked/simulator-sdk/temFiles/dist/preload/bgPreload.js:164), :4:31)
at f (eval at window.loadTmaScript (/Applications/bytedanceide.app/Contents/Resources/app.asar.unpacked/simulator-sdk/temFiles/dist/preload/bgPreload.js:164), :1:1537)
at eval (eval at window.loadTmaScript (/Applications/bytedanceide.app/Contents/Resources/app.asar.unpacked/simulator-sdk/temFiles/dist/preload/bgPreload.js:164), :1:158760)
at eval (eval at window.loadScript (/Applications/bytedanceide.app/Contents/Resources/app.asar.unpacked/simulator-sdk/temFiles/dist/preload/bgPreload.js:164), :4:18)
at f (eval at window.loadTmaScript (/Applications/bytedanceide.app/Contents/Resources/app.asar.unpacked/simulator-sdk/temFiles/dist/preload/bgPreload.js:164), :1:1537)
at eval (eval at window.loadTmaScript (/Applications/bytedanceide.app/Contents/Resources/app.asar.unpacked/simulator-sdk/temFiles/dist/preload/bgPreload.js:164), :1:158760)
at eval (eval at window.loadScript (/Applications/bytedanceide.app/Contents/Resources/app.asar.unpacked/simulator-sdk/temFiles/dist/preload/bgPreload.js:164), :8:14)
at f (eval at window.loadTmaScript (/Applications/bytedanceide.app/Contents/Resources/app.asar.unpacked/simulator-sdk/temFiles/dist/preload/bgPreload.js:164), :1:1537)
at eval (eval at window.loadTmaScript (/Applications/bytedanceide.app/Contents/Resources/app.asar.unpacked/simulator-sdk/temFiles/dist/preload/bgPreload.js:164), :1:158760)
at eval (eval at window.loadScript (/Applications/bytedanceide.app/Contents/Resources/app.asar.unpacked/simulator-sdk/temFiles/dist/preload/bgPreload.js:164), :28:12)
at f (eval at window.loadTmaScript (/Applications/bytedanceide.app/Contents/Resources/app.asar.unpacked/simulator-sdk/temFiles/dist/preload/bgPreload.js:164), :1:1537)
at app-service.js:24

@liusure
Copy link

liusure commented Jul 16, 2019

把这个关掉就可以了,类似微信
1563264786152

@Chen-jj Chen-jj closed this as completed Jul 16, 2019
@devandroid
Copy link

把这个关掉就可以了,类似微信
1563264786152

十分感谢,正解

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants