关于vant2 组件van-dropdown-item,在IOS手机上,特定条件下无法点击问题的探讨

情景重现

先贴有问题的代码

复制代码
<template>
  <div :class="showBar ? 'homeContain' : 'homeContain-nobar'">
    <div class="contant" id="content">
      <van-dialog v-model="loading" :before-close="onBeforeClose" :show-confirm-button="false">
        <div style="text-align: center; line-height: 100px">
          <van-loading size="24px">加载中...</van-loading>
        </div>
      </van-dialog>

      <div>
        <div class="contian-title-div">
          <div style="display: flex">
            <div class="contain-title">{{ hospitalName }}</div>
            <van-dropdown-menu style="flex: 1">
              <van-dropdown-item
                v-model="valueUserName"
                :options="optionUserName"
                @change="userNameChange"
              />
            </van-dropdown-menu>
          </div>
        </div>

        <div v-if="list.length === 0">
          <div class="text-center" style="padding-top: 60px; height: 70vh">
            <div class="back-white pad-16 border-r-10">
              <img src="@/assets/images/room/noHos.png" width="150" />
              <h3>暂无排队记录</h3>
            </div>
          </div>
        </div>
        <div style="display: flex; flex-direction: column" v-else>
          <div style="overflow-y: scroll; height: 72vh">
            <van-list
              @load="onLoad"
              style="margin: 10px; flex: 2 1 0%; margin-top: 1.6rem"
            >
              <div
                class="back-white pad-16 border-r-10"
                style="margin: 1em 0 0 0"
                v-for="item in list"
                :key="item.id"
              >
                <div>
                  <img
                    src="@/assets/images/icon/boy.png"
                    class="contain-img"
                    v-if="userSex === 1"
                  />
                  <img
                    src="@/assets/images/icon/girl.png"
                    class="contain-img"
                    v-if="userSex === 2"
                  />
                  <div style="display: flex; padding: 8px">
                    <div class="contain-div1">
                      <div class="contain-name">{{ item.patientName }}</div>
                      <div
                        class="gray-9"
                        style="font-size: 14px"
                        v-if="userPhone"
                      >
                        {{
                          userPhone.replace(/(\d{3})\d{4}(\d{4})/, "$1****$2")
                        }}
                      </div>
                    </div>
                    <div class="contain-div-right">
                      <div class="contain-name">{{ item.deptName }}</div>
                      <div class="gray-9" style="font-size: 14px">
                        {{ item.orgName }}
                      </div>
                    </div>
                  </div>
                </div>

                <div class="boxcard" style="margin-top: 10px">
                  <div>
                    <div
                    class="div-notice"
                    style="  margin-bottom: 10px;"
                      v-if="item.seeNo - item.seeingNo > 0"
                    >
                      {{ item.seeingName }} {{ item.seeingNo }} {{ item.seeingDocTime?'('+item.seeingDocTime+')':'' }}
                      
                    </div>
                    <div
                      style="text-align: center"
                      class="gray-9"
                   
                    >
                      当前叫号
                    </div>
                  </div>
                  <div>
                    <div
                      class="div-notice"
                      v-if="item.seeNo - item.seeingNo < 0"
                    >
                    现已过您的号码, <br>如有疑问请咨询服务台
                    </div>
                    <div
                      class="div-notice"
                      v-if="item.seeNo - item.seeingNo == 0"
                    >
                      请至{{ item.deptName }}诊室就诊
                    </div>
                    <div style="text-align: center" class="gray-9"></div>
                  </div>

                  <van-row style="margin-top: 10px">
                    <van-col span="12">您的号码:{{ item.seeNo }}</van-col>
                    <van-col
                      span="12"
                      style="
                        align-items: flex-end;
                        display: flex;
                        flex-direction: column;
                      "
              
                      >预约时间: {{ item.seeDocTime?item.seeDocTime:'-:-' }}</van-col
                    >
                  </van-row>
                </div>
              </div>
            </van-list>
          </div>
        </div>
        <div style="margin: 20px">
          <van-button
            round
            block
            type="primary"
            @click="refreshList()"
            :loading="submitBol"
            loading-text="刷新中..."
            >刷新</van-button
          >
          <div class="last-fresh-time" v-if="lastRefreshTime">
            最后刷新时间:{{ lastRefreshTime }}
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

样式

css 复制代码
<style scoped>
.last-fresh-time {
  display: flex;
  justify-content: center;
  margin: 10px;
  font-size: 12px;
  color: #9b9b9b;
}

.contian-title-div {
  position: fixed;
  width: 100%;
  line-height: 0.58667rem;
  background: #fff;
}
.contain-title {
  flex: 1 1 0%;
  background-color: #fff;
  position: relative;
  align-items: center;
  display: flex;
  justify-content: center;

  color: #323233;
  font-size: 14px;
  line-height: 0.58667rem;
}
.contain-img {
  height: 45px;
  width: 45px;
  border-radius: 50%;
  float: left;
  margin-right: 5px;
}
.contain-name {
  font-size: 14px;
  font-weight: 600;
}
.contain-div1 {
  flex: 1;
  margin-left: 5px;
}
.contain-div-right {
  flex: 1;
  margin-right: 5px;
  align-items: flex-end;
  display: flex;
  flex-direction: column;
}
.contant {
  padding: 0;
}
.van-dropdown-menu >>> .van-dropdown-menu__bar {
  box-shadow: 0 0 0;
}

.div-notice {
  text-align: center;
  font-size: 18px;
  font-weight: 550;
  margin-top: 20px;
  margin-bottom: 20px;
}
</style>

van-dropdown-menu >>> .van-dropdown-menu__bar

这一行是对组件内的样式进行了修改

上个图直观一些

右上角人名可以切换,用到的就是van-dropdown-menu,这个在web,在android,都没有问题,但是在IOS机型上,有时候点击没反应。刚开始以为是不兼容,但是在某些情况下又能切换,所以排除了不兼容的情况,多次试验以后,发现在排队列表没有数据的情况下,可以切换,有数据的情况下,不能切换

经过排查,一个一个修改,试验,是一个样式引起的问题

css 复制代码
.contian-title-div {
  position: fixed;
  width: 100%;
  line-height: 0.58667rem;
  background: #fff;
}

把这个 position: fixed;删掉,在IOS上,和van-dropdown-menu有冲突,会出现点击没反应的问题

相关推荐
与火星的孩子对话11 小时前
Unity进阶课程【六】Android、ios、Pad 终端设备打包局域网IP调试、USB调试、性能检测、控制台打印日志等、C#
android·unity·ios·c#·ip
恋猫de小郭1 天前
Flutter Widget Preview 功能已合并到 master,提前在体验毛坯的预览支持
android·flutter·ios
点金石游戏出海2 天前
每周资讯 | Krafton斥资750亿日元收购日本动画公司ADK;《崩坏:星穹铁道》新版本首日登顶iOS畅销榜
游戏·ios·业界资讯·apple·崩坏星穹铁道
旷世奇才李先生2 天前
Swift 安装使用教程
开发语言·ios·swift
90后的晨仔2 天前
Xcode16报错: SDK does not contain 'libarclite' at the path '/Applicati
ios
finger244802 天前
谈一谈iOS线程管理
ios·objective-c
Digitally2 天前
如何将大型视频文件从 iPhone 传输到 PC
ios·iphone
梅名智2 天前
IOS 蓝牙连接
macos·ios·cocoa
美狐美颜sdk2 天前
跨平台直播美颜SDK集成实录:Android/iOS如何适配贴纸功能
android·人工智能·ios·架构·音视频·美颜sdk·第三方美颜sdk
恋猫de小郭2 天前
Meta 宣布加入 Kotlin 基金会,将为 Kotlin 和 Android 生态提供全新支持
android·开发语言·ios·kotlin