duoshuo / airpub

a pure front-end blog engine powered by duoshuo API
http://airpub.io
MIT License
361 stars 41 forks source link

关于主题开发的一些问题 #19

Closed banrikun closed 9 years ago

banrikun commented 9 years ago

这两天在折腾遇到几个小问题:

1.在 archive.html 页面不能像 single.html 页面那样正常的调用 {{articleID}},导致无法获取当前文章的评论数等信息

2.不知道如何对于参数 uri: article.thread_id 进行扩展使用,比如需要进入这个 url 的某个锚记位置...比如直接链接到文章的 #comment 评论位置

3.个人认为样式分离的还不够彻底,DIY主题的时候明显。http://airpub.qiniudn.com/dist/airpub-dependencies.min.css ,这个样式表内似乎也有不少东西……唔最后没办法只能删掉了这句,不然很多地方我都要继续在自己的 css 里重新定义一次。reset 过了也没有用 -。-

guo-yu commented 9 years ago

@banrikun 稍等我看看

guo-yu commented 9 years ago
  1. archive.html 页面是一个文章列表,airticle ID 是在 ng-repeat 循环里的。这里暴露出来的变量是 articles 数组,你需要看哪个文章的 ID,可以在循环里单独列出,也可以使用 articles[0].thread_id 这种方法去取得
  2. ui-sref="layout.single({uri: article.thread_id })" 这段话是告诉 angular-ui-router 跳转到 layout.single 试图,并且传入参数对象。这个对象里的 uri 就是个字符串,想要写成什么都行,比如你想要在这个字符串背后加一个 #comments 直接这样写就成:layout.single({uri: article.thread_id + '#comments' })
  3. airpub-dependencies.min.css 顾名思义是依赖模块的所有样式表了,包括依赖的库,编辑器的样式等等,你遇到了什么情况导致这个库里的样式影响到你自定义的样式?可以举个例子,我们具体分析一下
banrikun commented 9 years ago

感谢回复,1和2我等下就去尝试。 3的话,会让我的文章列表变为圆角矩形...并且在:hover下,宽度会改变

至少这两点我个人觉得算是主题中自己DIY常用到的部分,所以应该放在chill.css中,而不是airpub-dependencies中 -v-

guo-yu commented 9 years ago

问题 2 存在一个问题,就是 airpub 的路由代码并不会去删除 hash,所以这样写可能达成不了你想要的效果,具体可以看 /src/controllers/single.js 代码第 13 行。

guo-yu commented 9 years ago

和主题相关的效果都是在 chill 主题里的,并不会出现在 http://airpub.qiniudn.com/dist/airpub-dependencies.min.css 里,尝试审查一下,我记得这个样式是写在 chill 这个主题里的

banrikun commented 9 years ago

chill我删除了还有,dependencies删除了就没了。添加上dependencies又这样了,应该是写到了dependencies里了。。。我是40行构建的

guo-yu commented 9 years ago

@banrikun 右键审查元素,看下样式覆盖的情况,不要凭空 debug 呀

guo-yu commented 9 years ago

这段样式代码实际上在 chill/archive.less 文件的第 16 行。你可以看看

banrikun commented 9 years ago

唔 找到了宽度原因了 是因为box-sizing导致的,唔我一直不用这个的 但是圆角矩形以及背景图片的问题貌似还没找到。。。应该也是盒子带来的问题,我再排查下...

guo-yu commented 9 years ago

@banrikun 嗯,有问题随时提 issue :)

banrikun commented 9 years ago

发现使用data-thread-key="{{article.thread_id}}"这样的调用方式是不行的,因为Airpub的文章在多说后台的Thread Key是24a37ed0-8f14-11e4-b9ba-b1c716e1f10a 这样的形式…… 求助嗷嗷嗷