Comments (6)
因为微信小程序用websocket的话,需要在小程序后台配置一个合法的域名,而且不能有端口号。所以我在代码里面默认注掉了。
如果要用的话,要么开 无appid的,要嘛就得在本地配置一下
简单说一下(以mac机器为例,安全域名是websocket.example.com):
- 在
/etc/hosts
文件中添加一行:
sudo sh -c 'echo "127.0.0.1 websocket.example.com">> /etc/hosts'
- 启动remotedev的时候用80端口
sudo remotedev --hostname=localhost --port=80
- 连接的代码用新的地址
function configureStore() {
return createStore(reducer, compose(devTools({
hostname: 'websocket.example.com',
port: 80,
secure: false
})));
}
我没有没有实测,不过思路大概是这样的。
from wechat-weapp-redux-todos.
@charleyw 试了一下没有无appid的,但是我这边提示
是版本不对么?
from wechat-weapp-redux-todos.
我完了试一下,最近没弄,不知道微信是不是有更新
from wechat-weapp-redux-todos.
@xiaoguozi 我也遇到这个问题
from wechat-weapp-redux-todos.
@charleyw 一样的问题,求解
from wechat-weapp-redux-todos.
不好意思,好久没用了。这个问题的原因是因为微信的开发工具的运行环境里面不让使用 window 变量。而在那个 devtools的源码里面有一些地方使用了 window 变量,在执行过程中 window 是 undefined 所以会报错。
我把临时把源码改了,你更新一下代码应该就好了。
然后,微信开发工具提供了在开发环境不检查安全域名,所以,不需要使用我上面说的那么复杂的办法配置了。把开发环境不校验请求域名以及 TLS 版本
选项勾上,就可以直接使用 localhost:5678访问了。
可以看一下 readme 我也更新了。
from wechat-weapp-redux-todos.
Related Issues (9)
- LICENSE HOT 1
- 请教 HOT 1
- 右边那个黑色界面是redux-devtools吗? HOT 2
- (intermediate value) is not a function
- 跑不起来 HOT 1
- 项目运行不起 HOT 1
- 项目运行报错缺少libs里面的文件,已运行dev和./node_modules/.bin/json-server --watch db.json --port 5678 还是报错 HOT 1
- 一个兼容性bug HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wechat-weapp-redux-todos.