zoukankan      html  css  js  c++  java
  • uni-app 循环列表项跳转指定外链解决方案<web-view>标签

    news.vue

    <view class="list">
                <view class="uni-padding-wrap backWhite wauto80" v-for="(item,index) in infoList" :key="index">
                    <view class="uni-flex info_item" @tap="openUrl(index)">
                        <view class="info">
                            <view class="title">
                                <span class="tag">{{item.label}}</span>
                                <text>{{ item.title }}</text>
                            </view>
                            <view class="des">
                                <text class="newsdata">{{ item.create_time }}</text>
                                <image class="w23" src="https://test134.vrapp.chot.cn/mini/picture/news_eye.png"></image> <text class="newsdata">{{ item.number }}</text>
                            </view>
                        </view>
                        <view class="imgRignt">
                            <image class="newsImg" :src="item.thumb"></image>
                        </view>
                    </view>
                </view>
                <uni-load-more :status="status" :content-text="contentText" />
    
            </view>
    methods: {
    // 传递new_id给要显示内容的页面 openUrl(index) { uni.navigateTo({ url:
    "../../pages/newDetail/newDetail?news_id=" + this.infoList[index].id }) }
    }

    newsDetail.vue

    <template>
        <view>
            <web-view :src='src'> </web-view>
        </view>
    </template>
    
    <script>
        export default {
            data() {
                return {
                    src: "",
                    news_id: ""
                }
            },
            onLoad: async function(option) {
                this.news_id = option.news_id;
                const res = await this.$myRequset({
                    url: "/api",
                    method: "POST",
                    data: {
                        operate: "News.get_link",
                        news_id: this.news_id
                    },
                    header: {
                        'content-type': 'application/form'
                    }
                });
                this.src = res.data.data.link;
            }
        }
    </script>
    
    <style>
    </style>
  • 相关阅读:
    什么是php面向对象及面向对象的三大特性
    php类的定义与实例化方法
    php面向对象之$this->用法简述
    url的主要功能是什么
    PHP字符串比较函数详解
    PHP截取字符串函数substr()函数实例用法详解
    php 读取文件
    php 正则达达示中的模式修正符
    php正则表示中的元字符
    php 正则表达示中的原子
  • 原文地址:https://www.cnblogs.com/LindaBlog/p/13515951.html
Copyright © 2011-2022 走看看