<view class="flex-column">
<view class="flex-column" style="padding: 24rpx 32rpx;">
<text class="text-title">{{newsDetailsData.title}}</text>
<view class="flex-row center-row space-between" style="margin-top: 20rpx;">
<text class="text-999">{{ isschool==1?newsDetailsData.createdAt:newsDetailsData.update_time }}</text>
<text class="text-999">{{ isschool==1?newsDetailsData.source: newsDetailsData.source}}</text>
<view class="flex-row center-row" v-if="isschool!='1'">
<image style="width: 30rpx; height: 20rpx; margin: 0 5rpx 0 20rpx;"
src="/static/images/public/eyes_n.png" mode="aspectFit"></image>
<text class="text-999">{{$tool.formatReadNum(newsDetailsData.view_total)}}</text>
</view>
</view>
</view>
<view class="news-content container" v-html="newsDetailsData.content"></view>
<loading v-show="loadshow"></loading>
</view>
</template>
<script module="test" lang="renderjs">
export default {
mounted() {
setTimeout(() => {
const aNodes = document.getElementsByTagName('a');
console.log('aaa', aNodes)
for(let i=0;i<aNodes.length;i++) {
let items = aNodes[i]
// console.log(item.href)
items.addEventListener('click', function(e) {
e.preventDefault()
console.log('==========', e)
});
}
}, 2000);
},
methods: {
// ...
}
}
</script>
<script>
import userManager from "../../../common/manager/user-manager.js"
export default {
data() {
return {
loadshow: false,
ID: "",
newsListData: {},
newsDetailsData: {},
newsCollects: [],
isschool: 0,
shareData: {},
newId: null
}
},
onLoad(options) {
// 传递新闻ID进来的操作
console.log('新闻onload', options)
let data = null
if (options.id) {
this.newId = options.id
this.$request.newsDetail({ id: this.newId }).then(res => {
data = res.data
console.log('sssssss', res)
console.log(data);
this.newsListData = data
this.newsDetailsData = data
this.ID = this.newsDetailsData.id ? ('id_' + this.newsDetailsData.id) : ('nid_' + this.newsDetailsData.nid)
})
} else {
data = JSON.parse(decodeURIComponent(options.data))
console.log(data);
this.newId = data.id
this.newsListData = data
this.newsDetailsData = data
this.ID = this.newsDetailsData.id ? ('id_' + this.newsDetailsData.id) : ('nid_' + this.newsDetailsData.nid)
}
if (options.num == 1) {
this.isschool = 1
} else {
this.isschool = options.num
}
// 获取收藏本地
this.newsCollects = getApp().globalData.newsCollects
const isCollect = this.newsCollects.some(item => item == this.ID)
// 判断是否收藏
if (isCollect) {
this.setCollectBtnWith(true)
}
this.$nextTick(() => {
this.getSchoolNewsDetail()
})
}
}
</script>
<style lang="scss" scoped>
.container {
padding: 16rpx 32rpx 16rpx 32rpx;
tr td:nth-child(3) {
/* 样式属性 */
min-width: 3rem !important;
}
}
.text-title {
width: 100%;
color: #333333;
font-size: 40rpx;
font-weight: bold;
}
.text-999 {
color: #999;
font-size: 25rpx;
}
</style>``` - 发布:2023-12-25 17:40
- 更新:2023-12-25 17:56
- 阅读:580
产品分类: uniapp/App
PC开发环境操作系统: Mac
PC开发环境操作系统版本号: 14.1.2
HBuilderX类型: 正式
HBuilderX版本号: 3.96
手机系统: Android
手机系统版本号: Android 14
手机厂商: 模拟器
手机机型: 模拟器
页面类型: vue
vue版本: vue2
打包方式: 云端
项目创建方式: HBuilderX
示例代码:
操作步骤:
写上<script module="test" lang="renderjs"></script>保存就提示错误
写上<script module="test" lang="renderjs"></script>保存就提示错误
预期结果:
正常编译运行
正常编译运行
实际结果:
编译报错卡住
✘ [ERROR] Unterminated regular expression
17:27:58.049 <stdin>:21:9:
17:27:58.053 21 │ </script>
17:27:58.053 ╵ ^
17:27:58.075 [plugin:uni:app-vue-renderjs] Build failed with 1 error:
17:27:58.088 <stdin>:21:9: ERROR: Unterminated regular expression
编译报错卡住
✘ [ERROR] Unterminated regular expression
17:27:58.049 <stdin>:21:9:
17:27:58.053 21 │ </script>
17:27:58.053 ╵ ^
17:27:58.075 [plugin:uni:app-vue-renderjs] Build failed with 1 error:
17:27:58.088 <stdin>:21:9: ERROR: Unterminated regular expression
bug描述:
使用 renderjs 编译报错,刚开始能正常使用,也能获取到 dom,大概 10 分钟后就开始报错,并且回滚代码后再次重写 renderjs 还是报错,无法编译,去掉带 renderjs 的 script标签就能正常编译运行
✘ [ERROR] Unterminated regular expression
17:27:58.049 <stdin>:21:9:
17:27:58.053 21 │ </script>
17:27:58.053 ╵ ^
17:27:58.075 [plugin:uni:app-vue-renderjs] Build failed with 1 error:
17:27:58.088 <stdin>:21:9: ERROR: Unterminated regular expression
最佳回复
DCloud_UNI_OttoJi
感谢你的反馈
2023-12-26 10:36
1***@163.com
什么意思,咋解决的
2024-09-27 14:31