有两篇文章写得比较好的 https://www.oschina.net/code/snippet_1052786_47435 https://www.jianshu.com/p/4c6eec65fdc3