<template> <view class="page"> <u-navbar :title="title" :border-bottom="false" :background="bgc" title-color='#000' title-size='36' height='45'></u-navbar> <view class="cont" v-html="content"></view> </view> </template> <script> export default { data() { return { bgc: { backgroundColor: "#fff", }, info: {}, userinfo: {}, areaInfo: {}, content: '', title:'' } }, onLoad(options) { if (options.title && options.content) { // 解码 title 和 content const title = decodeURIComponent(options.title); const content = JSON.parse(decodeURIComponent(options.content)); // 设置数据 this.title = title this.content = content this.insertPhoneNumberAndDate() } }, methods: { getagree() { let id = uni.getStorageSync('areaId'); this.$u.get(`/app/article/list?areaId=${id}&tag=agreement`).then((res) => { if (res.code === 200) { this.info = res.rows[0]; this.insertPhoneNumberAndDate(); } else { uni.showToast({ title: res.msg, icon: 'none', duration: 2000 }); } }); }, insertPhoneNumberAndDate() { // 替换所有的 为 \u00A0 this.content = this.content.replace(/ /g, '\u00A0'); } } } </script> <style lang="scss"> page { background-color: #fff; } .page { width: 750rpx; .cont { margin-top: 34rpx; margin: 0 auto; width: 634rpx; } } </style>