小程序
小游戏
企业微信
微信支付
扫描小程序码分享
图片长按菜单show-menu-by-longpress没有反应?排查显示已经设置成true了,但是就是没效果
2 个回答
加粗
标红
插入代码
插入链接
插入图片
上传视频
原生小程序测试没问题,而且预览图片有方法,并不需要自己写长按属性
你好,麻烦通过点击下方“反馈信息”按钮,提供出现问题的。
<template>
<view v-if="isshow" class="w-full fixed top-0 bottom-0 bg-[rgb(0,0,0,0.5)] z-[9999] flex items-center justify-center">
<view class="absolute w-[80%] flex flex-col items-center rounded-[10px] bg-[#FDEDE0] box-border pb-[35px]">
<view class="w-full">
<!-- 根据fullimg的值动态改变src -->
<image show-menu-by-longpress ="true"
:src="fullimg ? qiweixininfo.img : staticurl + '156.png'"
class="w-full rounded-[10px]"
mode="widthFix"
/>
</view>
<view class="absolute w-full h-full flex flex-col">
<!-- 当fullimg为true时,不渲染这个view -->
<view class="flex-1 flex justify-center">
<view v-if="!fullimg" class="w-[160rpx] h-[160rpx] bg-[#000] mt-[315rpx]">
<image show-menu-by-longpress="true" lazy-load :src="qiweixininfo.img" class="w-full h-full" />
<view class="flex-[0_1_40px] flex items-center justify-center">
<view v-if="!isclose" class="text-[#666] text-[13px]">
需要等待 {{ qiweixininfo.wait }} 秒后才能关闭
<view @click="close" v-else class="bg-[#E84545] p-[5px_10px] rounded-[5px]">
<view class="text-[12px] text-[#fff]">关闭</view>
</template>
<script setup>
import { ref } from 'vue'
import base from '@/utils/base'
import appUser from '@/api/app/user'
import { staticurl } from '@/env'
import appSystem from '@/api/app/system'
const isshow = ref(false)
const qiweixininfo = ref({})
const isclose = ref(false)
const fullimg = ref(false)
let time
const getisqiweiimg = async () => {
const res = await appSystem.getconfig({ key: 'is_qiwei_img' })
return res.data
}
const open = async () => {
if(await getisqiweiimg()){
fullimg.value = true
isshow.value = true
isclose.value = false
const res = await appUser.qiweixininfo()
qiweixininfo.value = res.data
// qiweixininfo.value.wait = 3
clearInterval(time)
time = setInterval(() => {
qiweixininfo.value.wait--
if (qiweixininfo.value.wait == 0) {
isclose.value = true
}, 1000)
const close = () => {
isshow.value = false
const getisshow = () => {
return isshow.value
defineExpose({ open, getisshow })
</script>
上面是我的代码,然后这是弹窗效果,长按没效果
关注后,可在微信内接收相应的重要提醒。
请使用微信扫描二维码关注 “微信开放社区” 公众号
原生小程序测试没问题,而且预览图片有方法,并不需要自己写长按属性
<template>
<view v-if="isshow" class="w-full fixed top-0 bottom-0 bg-[rgb(0,0,0,0.5)] z-[9999] flex items-center justify-center">
<view class="absolute w-[80%] flex flex-col items-center rounded-[10px] bg-[#FDEDE0] box-border pb-[35px]">
<view class="w-full">
<!-- 根据fullimg的值动态改变src -->
<image show-menu-by-longpress ="true"
:src="fullimg ? qiweixininfo.img : staticurl + '156.png'"
class="w-full rounded-[10px]"
mode="widthFix"
/>
</view>
<view class="absolute w-full h-full flex flex-col">
<!-- 当fullimg为true时,不渲染这个view -->
<view class="flex-1 flex justify-center">
<view v-if="!fullimg" class="w-[160rpx] h-[160rpx] bg-[#000] mt-[315rpx]">
<image show-menu-by-longpress="true" lazy-load :src="qiweixininfo.img" class="w-full h-full" />
</view>
</view>
<view class="flex-[0_1_40px] flex items-center justify-center">
<view v-if="!isclose" class="text-[#666] text-[13px]">
需要等待 {{ qiweixininfo.wait }} 秒后才能关闭
</view>
<view @click="close" v-else class="bg-[#E84545] p-[5px_10px] rounded-[5px]">
<view class="text-[12px] text-[#fff]">关闭</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script setup>
import { ref } from 'vue'
import base from '@/utils/base'
import appUser from '@/api/app/user'
import { staticurl } from '@/env'
import appSystem from '@/api/app/system'
const isshow = ref(false)
const qiweixininfo = ref({})
const isclose = ref(false)
const fullimg = ref(false)
let time
const getisqiweiimg = async () => {
const res = await appSystem.getconfig({ key: 'is_qiwei_img' })
return res.data
}
const open = async () => {
if(await getisqiweiimg()){
fullimg.value = true
}
isshow.value = true
isclose.value = false
const res = await appUser.qiweixininfo()
qiweixininfo.value = res.data
// qiweixininfo.value.wait = 3
clearInterval(time)
time = setInterval(() => {
qiweixininfo.value.wait--
if (qiweixininfo.value.wait == 0) {
clearInterval(time)
isclose.value = true
}
}, 1000)
}
const close = () => {
isshow.value = false
}
const getisshow = () => {
return isshow.value
}
defineExpose({ open, getisshow })
</script>
上面是我的代码,然后这是弹窗效果,长按没效果