|
|
@@ -39,7 +39,7 @@
|
|
|
<text class="detail-summary-text">{{ article.summary }}</text>
|
|
|
</view>
|
|
|
<view class="divider"></view>
|
|
|
- <view class="detail-body"><mp-html :content="article.content" :domain="config.API_BASE_URL" :tag-style="contentTagStyle" /></view>
|
|
|
+ <view class="detail-body"><mp-html :content="article.content" :domain="apiBaseUrl" :tag-style="contentTagStyle" /></view>
|
|
|
|
|
|
<!-- 内容关联(相关文章 / 相关活动 / 相关商品,按标签匹配;无匹配整块隐藏,触底分页加载) -->
|
|
|
<related-content ref="relatedContent" source-type="article" :source-id="articleId" />
|
|
|
@@ -138,6 +138,12 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
+ // 模板中无法直接访问模块级 import 的 config(Vue 模板绑定解析为实例属性 this.config,实例上无此属性
|
|
|
+ // → undefined.API_BASE_URL 抛错,导致文章详情页渲染中断)。经 computed 暴露 API 域名供模板使用;
|
|
|
+ // 方法内仍可直接用模块级 config(函数作用域闭包引用,正常)。
|
|
|
+ apiBaseUrl() {
|
|
|
+ return config.API_BASE_URL
|
|
|
+ },
|
|
|
contentTagStyle() {
|
|
|
var scale = this.fontScale || 1
|
|
|
var fontSize = 32 * scale
|