<template>
	<view>
		<mp-html :content="detail.content" />
	</view>
</template>

<script>
	import mpHtml from '@/uni_modules/mp-html/components/mp-html/mp-html'
	export default {	
		components: {
			mpHtml
		},
		data(){
			return{
				detail:{}
			}
		},
		onLoad(e) {
			uni.setNavigationBarColor({
				frontColor: '#ffffff',
				backgroundColor: this.$store.state.color,
			})
			this.http(e.id);
		},
		methods:{
			http(id){
				this.$http.request('yy/article_detail', {
					id,
				}).then(res => {
					if (res.code == "200") {
						if(res.data.content){
							res.data.content = res.data.content.replace(/\<img/gi,
								'<img style="max-width:100%;height:auto" ')
						}
						uni.setNavigationBarTitle({
							title:res.data.title
						})
						this.detail = res.data		
					}
				}).catch((res) => {
					// console.log(res, "666")
					uni.showToast({
						title: res.message,
						icon: 'none'
					})
				});
			}
		}	
	}
</script>

<style>
</style>
