立诚勿怠,格物致知
It's all about connecting the dots

2017年08月的文章

微信PC客户端不支持object.assign方法

Recently, I encountered a bug: my frontend project can work normally in WeChat mobile clients but when visited in WeChat PC client for window OS, the page turned out be be blank -_-. After some attempts, I found that it's due to the unavailability of Object.assign method in WeChat PC client for window OS. Therefore, we need to write polyfill for Object.assign method. There is not need to think how to write this polyfill ourselves. Just copy from MDN ^_^.

OSChina支持Pages功能了

This is not a new function supported by OSChina, but I'm just aware of that yesterday. Long time ago, I had once made a choice whether to use github or OSChina to be the repository storing my public code, and I finally use github later due to the fact that I found OSChina seems to have to function like github Pages. You know, as I front end developer, it's import to show not both your code but also its visual display to others. Therefore, functions like github pages are very meaningful to me and it's also very convenient. Without functions like github pages, I will need to build my code and then use FTP/SFTP tools like FileZilla to upload my frontend static files to my server. If you change your code in high frequency, you will find this way quite time-wasting. Whereas if you use github pages, all you need to do after rebuild your code is type one line's command in your command line tools and press enter button ^_^.

未分类 阅读(4247)去评论赞(1)

Vuex Data Persistence数据持久化

In one of my frontend project using VueJS, there is a need to maintain run-time data in javascript to local hardware so that these data will not be lost in case of a page refreshing. This requirement can be saying in another way - data persistence is required. Since the diversity of frontend environment, there are many stuff can be employed to save your run-time data. For example, if you use react-native, you can use one of React Native's API called AsyncStorage; if you are written html webpage, the Html api sessionStorage, localStorage and cookie can all be employed. And today we are going to employ localStorage, we're going to talk about data persistence in webpage developed using VueJS.

javascript验证组织结构代码

组织机构代码是对中华人民共和国内依法注册、依法登记的机关、企、事业单位、社会团体,以及其他组织机构颁发一个在全国范围内唯一的、始终不变的代码标识。国家质检总局负责组织机构代码的管理工作。 如同居民的身份证一样,组织机构代码证是组织机构在社会经济活动中统一赋予的单位身份证。组织机构代码系统覆盖范围广泛,对申领代码单位的资质审核也有数字档案(档案数字化)作为凭证,可以动态追溯每一个组织机构的历史发展变化。

JavaScript 阅读(1946)去评论赞(0)

书摘·杀死一只反舌鸟

“赫克,”阿蒂克斯转过身去说,“如果我们隐瞒这件事,那就完全否定了我教育杰姆的做人原则。有时候,我觉得自己做家长很失败,可是我就是他们拥有的一切。在杰姆仰视别人之前,他首先仰视的是我,我希望自己正直地活着,以便能坦然面对他……如果我默许这类事情发生,坦率地讲,我就没法再正视他的眼睛,一旦我不能正视他的眼睛,我就知道自己已经永远失去了他。我不像失去他和斯库特,因为他们就是我的一切。”

读书笔记 阅读(2616)去评论赞(0)

React Native系列之BackAndroid

检测硬件设备上的返回按钮被“按”的事件,如果未绑定监听器或者没有返回true的监听器,那么按返回键默认会关闭app。订阅该事件的监听器会以与订阅顺序相反的顺序被执行(最后订阅该事件的监听器最先被执行),并且如果有一个监听器返回了true,那么在此之前订阅该事件的监听器将不再被执行。

400 bad request: Required request part 'file' is not present

最近碰到一个更新用户个人头像的需求,允许用户选择APP内置的几张示例图片作为头像,也允许用户拍照上传个人头像(不论是选择示例图片作为个人头像还是用户自己拍照作为个人头像,均会在文件字段之外再传其他参数,比如图片名,不只是一个文件字段)。计划中的接口是一个,拍照上传头像是由iOS和android开发在壳的层面上负责完成的,选择示例图片作为用户个人头像是在React Native层面予以实现的。因为是同一个接口,出于统一的目的,请求头中的Content-Type都使用“multipart/form-data; boundary=分隔符“这样的值(比如:Content-Type: multipart/form-data; boundary="bac9aebd-d9ff-40ef-bcf3-4fffdd1b2c00")。壳发的上传图片请求能正常地被服务器端处理,但是RN发的文件为空的请求就没法正常被处理,只知道报错信息为:400 bad request: Required request part 'file' is not present,跟后端交涉后被告知以前没有处理过不传文件的情况,还说他们写的是中间件,请求进不了断点的话他们也处理不了。。。

Java 阅读(9804)评论(2)赞(3)

登录

找回密码

注册