<template>
	<view class="ql-editor">
		<u-parse :html="content"></u-parse>
		<u-toast ref="uToast" />
	</view>
</template>

<script>
	export default{
		data(){
			return{
				content:''
			}
		},
		onLoad(page){
			if (page.artId) {
				this.getDetails(page.artId)
			}
		},
		onShow(){
			
		},
		methods:{
			// 获取详情
			getDetails(id) {
				this.$u.api.getNewsDetails({id:id})
				.then(res=>{
					console.log('getNewsDetails',JSON.parse(JSON.stringify(res)));
					if (res.code === 200) {
						console.log(res.data);
						this.content = res.data.artContent;
					} else {
						this.$refs.uToast.show({
							title: res.msg,
							type: 'error'
						})
					}
				})
				.catch(err => {
					this.$refs.uToast.show({
						title: '操作失败!',
						type: 'error'
					})
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	// page{padding: 24rpx;}
	// @import  './newsDetails.scss'
	@import  '@/static/css/quill.bubble.scss';
	@import  '@/static/css/quill.core.scss';
	@import  '@/static/css/quill.snow.scss';
</style>
