|
[多端开发]
avm中通用事件中的touch事件有问题
[复制链接]
本帖最后由 Hello_绿洲 于 2022-2-17 16:09 编辑
avm中通用事件中的touch事件存在问题,页面分为页面A和页面B,页面A中放置一个头部,使用普通的view或者act中的a-nav-bar组件都试过,然后并列元素frame引入页面B,在页面B中的按钮touch事件监听手指按住上移,手指不松开,离开按钮位置,不行的时候会进入到touchcancel,可以的时候还是touchmove,手指松开才会进入到touchend,页面A中头部的高度过大或者过小,会导致页面B中按钮touch事件发生不行的情况,手指在按钮处按住上移,手指不松开,离开按钮位置,会进入到touchcancel
页面A
页面B
- <template>
- <view class="page">
- <scroll-view class="scroll-view flex" show-scrollbar="false" scroll-y></scroll-view>
- <view class="chat-operating disflex disflex-middle" id="chatOperating">
- <view class="flex">
- <view id="voiceButton" class="chat-input-box">
- <!-- 手指按住上移,手指不松开,离开按钮位置,不行的时候会进入到touchcancel,可以的时候还是touchmove,手指松开才会进入到touchend -->
- <view id="" class="chat-voice-word-box" @longpress="voiceLongpress"
- @touchstart="voiceTouchstart" @touchmove="voiceTouchmove" @touchend="voiceTouchend"
- @touchcancel="voiceTouchcancel">
- <text class="chat-voice-word fz14 c-33344A">按住 说话</text>
- </view>
- </view>
- </view>
- </view>
- <safe-area class="b-fff"></safe-area>
- </view>
- </template>
- <script>
- // import ANavBar from "../../components/act/a-nav-bar";
- export default {
- name: 'test1_frm',
- apiready() {
- },
- install() {
- },
- installed() {
- },
- data() {
- return {
- }
- },
- methods: {
- voiceLongpress(e) {
- console.log("-----longpress----")
- },
- voiceTouchstart(e) {
- console.log("-----touchstart----")
- },
- voiceTouchmove(e) {
- console.log("-----touchmove----")
- },
- voiceTouchend(e) {
- console.log("-----touchend----")
- },
- voiceTouchcancel(e) {
- console.log("-----touchcancel----")
- },
- }
- }
- </script>
- <style>
- .flex {
- flex: 1;
- }
- .page {
- width: 100%;
- height: 100%;
- }
- .scroll-view{
- background-color: #4bc5f5;
- }
- .chat-operating {
- width: 100%;
- min-height: 52px;
- background: #ffffff;
- padding: 7px 14px;
- z-index: 9999;
- }
- .chat-operating-img {
- width: 23px;
- height: 23px;
- }
- .chat-voice-word-box {
- height: 38px;
- border-radius: 19px;
- background-color: #F7F8FA;
- text-align: center;
- }
- .chat-voice-word {
- height: 38px;
- line-height: 38px;
- text-align: center;
- }
- </style>
复制代码
|
|