Showing
3 changed files
with
61 additions
and
1 deletions
@@ -9,7 +9,7 @@ | @@ -9,7 +9,7 @@ | ||
9 | <div class="main-detail"> | 9 | <div class="main-detail"> |
10 | <div class="article-context"> | 10 | <div class="article-context"> |
11 | <div class="context-title">{{data.articleTitle}}</div> | 11 | <div class="context-title">{{data.articleTitle}}</div> |
12 | - <div class="context-rich-text" v-html="data.richText"></div> | 12 | + <div ref="richText" class="context-rich-text" v-html="data.richText"></div> |
13 | </div> | 13 | </div> |
14 | 14 | ||
15 | <ArticleItemTopics v-if="data.topicList && data.topicList.length" class="topics-wrap" :data="data" :share="share"></ArticleItemTopics> | 15 | <ArticleItemTopics v-if="data.topicList && data.topicList.length" class="topics-wrap" :data="data" :share="share"></ArticleItemTopics> |
@@ -76,6 +76,8 @@ export default { | @@ -76,6 +76,8 @@ export default { | ||
76 | if (!this.$yoho.isiOS) { | 76 | if (!this.$yoho.isiOS) { |
77 | this.downgrade = true; | 77 | this.downgrade = true; |
78 | } | 78 | } |
79 | + | ||
80 | + this.handleRechText(); | ||
79 | }, | 81 | }, |
80 | computed: { | 82 | computed: { |
81 | ...mapState(['yoho']), | 83 | ...mapState(['yoho']), |
@@ -137,6 +139,11 @@ export default { | @@ -137,6 +139,11 @@ export default { | ||
137 | return this.data.lazy; | 139 | return this.data.lazy; |
138 | } | 140 | } |
139 | }, | 141 | }, |
142 | + watch: { | ||
143 | + 'data.richText': function() { | ||
144 | + this.handleRechText(); | ||
145 | + } | ||
146 | + }, | ||
140 | methods: { | 147 | methods: { |
141 | ...mapMutations(['SET_STATUS_BAR_COLOR']), | 148 | ...mapMutations(['SET_STATUS_BAR_COLOR']), |
142 | onFollowAuthor(follow) { | 149 | onFollowAuthor(follow) { |
@@ -161,6 +168,15 @@ export default { | @@ -161,6 +168,15 @@ export default { | ||
161 | }, | 168 | }, |
162 | onActionComment() { | 169 | onActionComment() { |
163 | }, | 170 | }, |
171 | + handleRechText() { | ||
172 | + this.$nextTick(() => { | ||
173 | + this.$refs.richText && this.$refs.richText.querySelectorAll('a').forEach(ele => { | ||
174 | + if (ele.querySelector('img')) { | ||
175 | + ele.classList.add('yoho-img-link'); | ||
176 | + } | ||
177 | + }); | ||
178 | + }); | ||
179 | + } | ||
164 | }, | 180 | }, |
165 | components: { | 181 | components: { |
166 | ArticleDetailHeader, | 182 | ArticleDetailHeader, |
@@ -282,6 +298,50 @@ export default { | @@ -282,6 +298,50 @@ export default { | ||
282 | list-style: inherit; | 298 | list-style: inherit; |
283 | } | 299 | } |
284 | } | 300 | } |
301 | + | ||
302 | + a { | ||
303 | + color: #468ee5; | ||
304 | + position: relative; | ||
305 | + display: inline-block; | ||
306 | + | ||
307 | + &:before { | ||
308 | + content: ""; | ||
309 | + display: inline-block; | ||
310 | + width: 36px; | ||
311 | + height: 36px; | ||
312 | + margin-right: 8px; | ||
313 | + background-image: url('~statics/image/article/link-text-icon.png'); | ||
314 | + background-size: cover; | ||
315 | + vertical-align: sub; | ||
316 | + position: relative; | ||
317 | + top: -1px; | ||
318 | + z-index: -1; | ||
319 | + } | ||
320 | + | ||
321 | + &.yoho-img-link:after { | ||
322 | + content: ""; | ||
323 | + width: 36px; | ||
324 | + height: 36px; | ||
325 | + background-image: url('~statics/image/article/link-img-icon.png'); | ||
326 | + background-size: cover; | ||
327 | + position: absolute; | ||
328 | + right: 8px; | ||
329 | + bottom: 8px; | ||
330 | + z-index: 1; | ||
331 | + } | ||
332 | + | ||
333 | + > img { | ||
334 | + margin-top: -50px; | ||
335 | + display: block; | ||
336 | + | ||
337 | + &:after { | ||
338 | + content: "1312312"; | ||
339 | + position: absolute; | ||
340 | + z-index: 1; | ||
341 | + background-color: #000; | ||
342 | + } | ||
343 | + } | ||
344 | + } | ||
285 | } | 345 | } |
286 | 346 | ||
287 | .topics-wrap { | 347 | .topics-wrap { |
apps/statics/image/article/link-img-icon.png
0 → 100644
3.39 KB
5.81 KB
-
Please register or login to post a comment