1***@qq.com
1***@qq.com
  • 发布:2022-08-16 14:21
  • 更新:2024-04-09 11:18
  • 阅读:280

view加@click之后,用键盘方向键控制会看到有焦点在移动。怎么能取消不用这种焦点

分类:uni-app

view加@click之后,用键盘方向键控制会看到有焦点在移动。怎么能取消禁用这种焦点
我想自己定义方向键控制其它东西,不要有这个焦点在动。
网页中我知道onfocus="this.blur()"
uniapp里怎么写。view好像没有@focus也没有blur

2022-08-16 14:21 负责人:无 分享
已邀请:
DCloud_UNI_WZF

DCloud_UNI_WZF

提供下测试工程并描述复现操作,谢谢

  • 1***@qq.com (作者)

    看看我发的行不

    2022-08-16 14:44

1***@qq.com

1***@qq.com (作者)

箭头指向那个是系统的焦点。绿色背景是我要控制自己定义的选项。我要用方向控制我那个选项,但是系统焦点也跟着动。

1***@qq.com

1***@qq.com (作者)

这本身还是触屏,用键盘和点击都得能操作。那个@click或者@tap还不能去掉

DCloud_UNI_WZF

DCloud_UNI_WZF

APP端吗? vue还是nvue? 看起来是获取焦点的同时给了一个样式,可否通过设置样式解决?
你上面提供的信息很少,所以希望提供下可复现demo,猜测是样式问题,和框架无关

  • 1***@qq.com (作者)

    有空看下吗

    2022-08-16 17:27

1***@qq.com

1***@qq.com (作者)

app端vue

<script>  
    import Topbar from '@/components/topbar.vue'  
    export default {  
        components: {  
            Topbar  
        },  
        data() {  
            return {  
                activeItem: 1,  
                runMode: ''  
            }  
        },  
        onShow() {  
            this.runMode = this.$store.state.setting.mode  
        },  
        methods: {  
            back() {  
                uni.redirectTo({ url: '/pages/setting/index' })  
            },  
            changeMode(val) {  
                this.$store.commit('setSetting', { ...this.$store.state.setting, mode: val })  
                this.runMode = val  
            }  
        },  
        watch: {  
            "$store.state.keypress.stamp"() {  
                this.$store.commit('startHomeTimer')  
                const key = this.$store.state.keypress.value  

                if (key == 'LEFT')  
                    this.back()  

                if (key == 'RIGHT') {  
                    this.activeItem == 1 && this.changeMode('doctor')  
                    this.activeItem == 2 && this.changeMode('default')  
                    this.activeItem == 3 && this.changeMode('big')  
                }   

                if (key == 'UP' && this.activeItem > 1)  
                    this.activeItem --  

                if (key == 'DOWN' && this.activeItem < 3)  
                    this.activeItem ++  
            }  
        }  
    }  
</script>  

<template>  
    <view :class="$store.state.styleName">  
        <topbar />  
        <view class="setting-view">  
            <view class="title">检查模式</view>  
            <view class="setting-body" style="margin-bottom: 1500rpx;">  
                <uni-list>  
                    <uni-list-item class="list-row" :class="{'list-row':true, 'active': activeItem==1}">  
                        <template v-slot:header><text class="list-item">医生模式</text></template>  
                        <template v-slot:footer><text class="list-item"><radio @click="changeMode('doctor')" :checked="runMode=='doctor'" color="#00a88e" /></text></template>  
                    </uni-list-item>  
                    <uni-list-item class="list-row" :class="{'list-row':true, 'active': activeItem==2}">  
                        <template v-slot:header><text class="list-item">默认模式</text></template>  
                        <template v-slot:footer><text class="list-item"><radio @click="changeMode('default')" :checked="runMode=='default'" color="#00a88e" /></text></template>  
                    </uni-list-item>  
                    <uni-list-item class="list-row" :class="{'list-row':true, 'active': activeItem==3}">  
                        <template v-slot:header><text class="list-item">大屏幕模式</text></template>  
                        <template v-slot:footer><text class="list-item"><radio @click="changeMode('big')" :checked="runMode=='big'" color="#00a88e" /></text></template>  
                    </uni-list-item>  
                </uni-list>  
            </view>  
        </view>  
        <view class="nav-button-group">  
            <view class="button" @click="back">按  
                <image src="../../static/images/login_left_arrow.png" />  
                返回  
            </view>  
            <view class="button" @click="back">按  
                <image src="../../static/images/login_right_arrow.png" />  
                确认  
            </view>  
        </view>  
    </view>  
</template>  
1***@163.com

1***@163.com

解决了没,我也遇到同样情况

要回复问题请先登录注册