2018年10月

比如vue-router,可以在多个地方写router hook,比如可以写全局guard,可以per-route写guard,甚至可以在component里写。

那么,在component里写,似乎不错,但一些hook,比如beforeRouteEnter,是不能用到这个component本身的,因为:

The beforeRouteEnter guard does NOT have access to this, because the
guard is called before the navigation is confirmed, thus the new
entering component has not even been created yet.

The tabindex attribute allows the developer to customize the tabbing navigation order of a document, enabling a tabbing order that differs from the default source code order, and making elements that are not normally tab navigable, such as paragraphs, able to receive tab focus.

一开始非常简单,直接把tracking script粘贴到public/index.html的head里,结果发现只是追踪这一页而已,因为所有变化都是在<div id="app"></div>里,所以你看不出来用户到底干嘛了,当然也根本追踪不了page view这些指标啊。

至少我是这么认为的。我为什么这么认为呢?因为我更新代码后,看了一下Google Analytics数据,发现只有1个pageview,这显然不对嘛,怎么可能就一个pageview呢。所以才恍然大悟。

于是就装了一个插件:vue-analytics,不知道效果咋样,但应该比粘贴到index.html里强吧。

刚才手欠,把一个textarea标签给改了,排版更好看了,但搞出来一堆whitespace,就是说,textarea里面凭空多了很多空格,看不到placeholder了,后来一搜,才发现原来是标签的写法的问题。

<!-- 这是正确的写法,一切正常 -->
<textarea></textarea>

<!-- 这是手欠的写法,于是就凭空多了很多whitespace -->
<textarea>
</textarea>