提交 58152aa3 编写于 作者: DCloud-WZF's avatar DCloud-WZF 💬

feat(App): add scroll-view

上级 372e8a91
<template> <template>
<view> <!-- #ifdef APP -->
<view class="banner"> <scroll-view style="flex: 1">
<image class="banner-img" :src="cover"></image> <!-- #endif -->
<text class="banner-title">{{title}}</text> <view>
<view class="banner">
<image class="banner-img" :src="cover"></image>
<text class="banner-title">{{title}}</text>
</view>
<view class="article-content">
<text>{{htmlNodes}}</text>
</view>
</view> </view>
<view class="article-content"> <!-- #ifdef APP -->
<text>{{htmlNodes}}</text> </scroll-view>
</view> <!-- #endif -->
</view>
</template> </template>
<script> <script>
export default { export default {
data() { data() {
return { return {
htmlNodes: "", htmlNodes: "",
pageVisible: false, pageVisible: false,
title: '', title: '',
cover : "", cover: "",
post_id : "", post_id: "",
} }
}, },
onLoad(event) { onLoad(event) {
...@@ -37,7 +42,7 @@ ...@@ -37,7 +42,7 @@
uni.request({ uni.request({
url: 'https://unidemo.dcloud.net.cn/api/news/36kr/' + this.post_id, url: 'https://unidemo.dcloud.net.cn/api/news/36kr/' + this.post_id,
success: (data) => { success: (data) => {
if(this.pageVisible){ if (this.pageVisible) {
if (data.statusCode == 200) { if (data.statusCode == 200) {
const result = data.data as UTSJSONObject const result = data.data as UTSJSONObject
this.htmlNodes = result["content"] as string; this.htmlNodes = result["content"] as string;
...@@ -104,4 +109,4 @@ ...@@ -104,4 +109,4 @@
font-size: 30rpx; font-size: 30rpx;
margin-bottom: 30rpx; margin-bottom: 30rpx;
} }
</style> </style>
\ No newline at end of file
<template> <template>
<!-- #ifdef APP -->
<scroll-view style="flex: 1">
<!-- #endif -->
<view class="article-content"> <view class="article-content">
<text>{{content}}</text> <text>{{content}}</text>
</view> </view>
<!-- #ifdef APP -->
</scroll-view>
<!-- #endif -->
</template> </template>
<script> <script>
export default { export default {
data() { data() {
return { return {
...@@ -27,4 +32,4 @@ ...@@ -27,4 +32,4 @@
font-size: 30rpx; font-size: 30rpx;
margin-bottom: 30rpx; margin-bottom: 30rpx;
} }
</style> </style>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册