<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>路由守卫 on 我的博客</title><link>https://blog.suoyiran.tech/tags/%E8%B7%AF%E7%94%B1%E5%AE%88%E5%8D%AB/</link><description>Recent content from 我的博客</description><generator>Hugo</generator><language>zh-CN</language><copyright>本博客所有文章除特别声明外，均采用 BY-NC-SA 许可协议。转载请注明出处！</copyright><lastBuildDate>Wed, 27 Feb 2019 14:53:09 +0800</lastBuildDate><atom:link href="https://blog.suoyiran.tech/tags/%E8%B7%AF%E7%94%B1%E5%AE%88%E5%8D%AB/index.xml" rel="self" type="application/rss+xml"/><item><title>仿VueRouter写小程序的路由守卫</title><link>https://blog.suoyiran.tech/post/%E4%BB%BFvuerouter%E5%86%99%E5%B0%8F%E7%A8%8B%E5%BA%8F%E7%9A%84%E8%B7%AF%E7%94%B1%E5%AE%88%E5%8D%AB/</link><pubDate>Wed, 27 Feb 2019 14:53:09 +0800</pubDate><guid>https://blog.suoyiran.tech/post/%E4%BB%BFvuerouter%E5%86%99%E5%B0%8F%E7%A8%8B%E5%BA%8F%E7%9A%84%E8%B7%AF%E7%94%B1%E5%AE%88%E5%8D%AB/</guid><description>
<![CDATA[<h1>仿VueRouter写小程序的路由守卫</h1><p>作者：前端老李（<no value>）</p>
        
          <p>小程序代码片段: <a href="#ZgotmplZ">wechatide://minicode/80h6lemI7c3Y</a></p>
<h2 id="涉及到的知识点">
<a class="header-anchor" href="#%e6%b6%89%e5%8f%8a%e5%88%b0%e7%9a%84%e7%9f%a5%e8%af%86%e7%82%b9"></a>
涉及到的知识点
</h2><p><strong>getCurrentPages()</strong>、<strong>Object.defineProperty()</strong></p>
<h2 id="基本描述">
<a class="header-anchor" href="#%e5%9f%ba%e6%9c%ac%e6%8f%8f%e8%bf%b0"></a>
基本描述
</h2><p>本功能可以让小程序开发者有对路由跳转进行控制的能力，跳转前可以做一些判断，比如用户的授权信息之类的（具体看业务需求），在跳转后可能主要是一些日志或埋点工作（具体看业务需求）</p>
        
        <hr><p>本文2019-02-27首发于<a href='https://blog.suoyiran.tech/'>我的博客</a>，最后修改于2019-02-27</p>]]></description><category>微信小程序</category></item></channel></rss>