帖子
帖子
用户
博客
课程
显示全部楼层

[云开发] 【已解决】DTouch在华为鸿蒙系统下没有任何反应

[复制链接]
发表于 2023-5-15 13:40:53
本帖最后由 安徽省农家书屋 于 2023-5-15 13:51 编辑


参考群里朋友写的测试代码,在手机上真机调试的时候,没有任何反应,这是啥情况


var DTouch = api.require('3DTouch');
        DTouch.setShortcutItems({
            items: [{
                type: 'com.stm.favorites',
                title: 'Favorites',
                icon: {
                    file: 'widget/statics/image/nav/1.png'
                },
                userInfo: {
                    'myfavorites': '我的收藏'
                }
            }, {
                type: 'com**.**pose',
                title: 'New Message',
                icon: {
                    type: 0
                },
                userInfo: {
                    'mymessage': '我的消息'
                }
            }]
        });
        

        if(api.systemType=="ios"){
            
            DTouch.setListener(
                function(ret, err) {
                    var type = ret.type;
                    if (type == 'com.mycompany.myapp.openfavorites') {

                    }
                }
            );

        }else{
            api.addEventListener({
                name:'appintent'
            }, function(ret){
                alert(JSON.stringify(ret))
            })
        }







android setShortcutItems ->items->{}->subtitle 这个字段不能为空需要传值



380
帖子
4
勋章
6
Y币
感谢分享解决经验。
111111
您需要登录后才可以回帖 登录

本版积分规则