uniapp小程序多行文本层级过高可以监听显示隐藏解决

 

 代码

<template>
    <view class="page">
        
            <view class="selfCard">
        
                    <u-form-item label="省市区" required>
                        <u-input @click="showAddress=true" :disabled='true' v-model="postForm.customerModel.region"
                            placeholder="请选择省市区"></u-input>
                        <u-icon @click="showAddress=true" slot='right' name="arrow-down" color="#e0e0e0" size="28" />
                        <u-select v-model="showAddress" mode="mutil-column-auto" :list="listAddress"
                            @confirm="confirmAddress"></u-select>
                    </u-form-item>

                    <u-form-item label="时间日期" required>
                        <u-input v-model="postForm.customerModel.add_time" :disabled='true' placeholder="请输入时间日期"
                            @click='showTime=true'>
                        </u-input>
                        <u-icon @click="showAddress=true" slot='right' name="arrow-down" color="#e0e0e0" size="28" />
                        <u-picker mode="time" v-model="showTime" :params="params" @cancel="showTime=false"
                            @confirm="timeConfirm"></u-picker>
                    </u-form-item>
                

                    <view class="" style="z-index: -1;">
                        <view class="" style="margin: 20rpx 0;">
                            备注
                        </view>
                        <textarea v-show="isInputContentFocus" type="text" placeholder-style='color:#c0c4cc' value=""
                            v-model="postForm.customerModel.remarks" placeholder="请输入备注" />
                    </view>

                </u-form>
            </view>

    

    </view>
</template>
<script>
    export default {
        data() {
            return {
    
                // 时间
                showTime: false,
                params: {
                    year: true,
                    month: true,
                    day: true,
                    hour: true,
                    minute: true,
                    second: true
                },
                // 获取省市区
                showAddress: false,
                listAddress: [],
                // 多行文本输入框
                isInputContentFocus: true,
            }
        },
        computed: {
            shows() {
                const {
                    showTime,
                
                    showAddress
                } = this
                return {
                    showTime,
                
                    showAddress
                }
            },
        },
        watch: {
            shows(e) {
                if (e.showTime == true || e.showAddress == true) {
                    this.isInputContentFocus = false;
                } else {
                    this.isInputContentFocus = true;
                }
            }
        },
        onLoad(e) {
            uni.setNavigationBarTitle({
                title: e.title
            });
            this.pageParams = e;
            if (e.id) {
                this.getPageData();
            }
            this.getAddress()
            this.DepartmentDropdown()
        },
        methods: {
        
            // 省市区
            confirmAddress(e) {
                this.postForm.customerModel.region = e[0].label + '--' + e[1].label + '--' + e[2].label
                this.postForm.customerModel.province_id = e[0].value
                this.postForm.customerModel.city_id = e[1].value
                this.postForm.customerModel.area_id = e[2].value
                // this.showMarket = false
            },
            // 时间
            timeConfirm(e) {
                console.log('时间', e)
                this.postForm.customerModel.add_time = e.year + '-' + e.month + '-' + e.day + ' ' + e.hour + ':' + e
                    .minute + ':' + e
                    .second
            },
        

        }
    }
</script>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
uniapp项目中,如果video标签的层级过高,会导致页面滑动时可能会遮挡顶部导航栏或弹窗效果。解决这个问题可以使用subNVues进行配置。在pages.json文件中,可以通过以下配置来解决这个问题: { "path": "pages/index/index", "style": { ... } } 此外,如果要创建一个预览图片并添加点击事件,可以使用以下代码: <image src="@/static/image/bofang.png" alt="" style="width: 350rpx; height: 280rpx; position: relative;" @click="onIsVideo(videoSrc)"> 如果要创建一个用于预览的video标签,可以使用以下代码: <video :src="onVideoSrc" x5-video-player-type="h5-page" :autoplay='true' v-show="false" style="width: 100vw; height: 100vh;" id="video_play"></video> 另外,在js代码中,可以通过以下代码来处理点击事件并解决视频遮挡的问题: onIsVideo(src){ // 获取视频地址 this.onVideoSrc = src // 获取video上下文对象 this.videoContext = uni.createVideoContext('video_play'); // 进入全屏状态 this.videoContext.requestFullScreen(); } 以上是解决uniapp中video标签层级过高问题的方法。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [uniapp video视频层级过高 遮挡顶部导航 页面弹窗 使用原生子窗体解决问题](https://download.csdn.net/download/weixin_42216995/87842998)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] - *2* *3* [解决 uniapp video视频组件层级过高,预览会覆盖其他组件的问题。](https://blog.csdn.net/haliboti/article/details/121927980)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值