帖子
帖子
用户
博客
课程
显示全部楼层
10
帖子
0
勋章
90
Y币

[插件使用] 底部导航

[复制链接]
发表于 2023-9-12 21:22:15
apicloud模块开发设计规范-原生代码案例,示例代码中各种代码的位置放哪?
var NVTabBarAnimation = api.require('NVTabBarAnimation');        NVTabBarAnimation.open({            styles: {                bg: '#fff',                h: 58,                dividingLine: {                    width: 0.5,                    color: '#ccc'                },                badge: {                    bgColor: '#f45815',                    numColor: '#fff',                    size: 7.0                }            },            items: [{                w: api.winWidth / 5.0,                bg: {                    marginB: 0,                    image: 'rgba(0,0,0,0)',                },                icon: {                    normal: 'widget://res/NVTabBarAnimation/1.png',                    highlight: 'widget://res/NVTabBarAnimation/11.png',                    rect: {                        w: 25.0,                        h: 25.0,                        x: 0,                        y: 0,                    },                },                animationIcons: {                    paths: ['widget://res/NVTabBarAnimation/1.png', 'widget://res/NVTabBarAnimation/2.png', 'widget://res/NVTabBarAnimation/3.png'],                    rect: {                        w: 25.0,                        h: 25.0,                        x: 0,                        y: 0                    },                    interval: 300                },                title: {                    text: '首页',                    size: 12.0,                    normal: '#696969',                    selected: '#ff0',                    marginB: 6.0,                    ttf: 'Alkatip Basma Tom'                },                rect: {                    w: api.winWidth / 5.0,                    x: 0,                    y: 0,                },            }, {                w: api.winWidth / 5.0,                bg: {                    marginB: 0,                    image: 'rgba(0,0,0,0)',                },                icon: {                    normal: 'widget://res/NVTabBarAnimation/2.png',                    highlight: 'widget://res/NVTabBarAnimation/22.png',                    rect: {                        w: 25.0,                        h: 25.0,                        x: 0,                        y: 0,                    },                },                animationIcons: {                    paths: ['widget://res/NVTabBarAnimation/1.png', 'widget://res/NVTabBarAnimation/2.png', 'widget://res/NVTabBarAnimation/3.png'],                    rect: {                        w: 25.0,                        h: 25.0,                        x: 0,                        y: 0                    },                    interval: 300                },                title: {                    text: '商圈',                    size: 12.0,                    normal: '#696969',                    selected: '#ff0',                    marginB: 6.0,                    ttf: 'Alkatip Basma Tom'                },                rect: {                    w: api.winWidth / 5.0,                    x: 0,                    y: 0,                },            }, {                w: api.winWidth / 5.0,                bg: {                    marginB: 0,                    image: 'rgba(0,0,0,0)',                },                icon: {                    normal: 'widget://res/NVTabBarAnimation/3.png',                    highlight: 'widget://res/NVTabBarAnimation/33.png',                    rect: {                        w: 25.0,                        h: 25.0,                        x: 0,                        y: 0,                    },                },                animationIcons: {                    paths: ['widget://res/NVTabBarAnimation/1.png', 'widget://res/NVTabBarAnimation/2.png', 'widget://res/NVTabBarAnimation/3.png'],                    rect: {                        w: 25.0,                        h: 25.0,                        x: 0,                        y: 0                    },                    interval: 300                },                title: {                    text: '地图',                    size: 12.0,                    normal: '#696969',                    selected: '#ff0',                    marginB: 6.0,                    ttf: 'Alkatip Basma Tom'                },                rect: {                    w: api.winWidth / 5.0,                    x: 0,                    y: 0,                },            }, {                w: api.winWidth / 5.0,                bg: {                    marginB: 0,                    image: 'rgba(0,0,0,0)',                },                icon: {                    normal: 'widget://res/NVTabBarAnimation/4.png',                    highlight: 'widget://res/NVTabBarAnimation/44.png',                    rect: {                        w: 25.0,                        h: 25.0,                        x: 0,                        y: 0,                    },                },                animationIcons: {                    paths: ['widget://res/NVTabBarAnimation/1.png', 'widget://res/NVTabBarAnimation/2.png', 'widget://res/NVTabBarAnimation/3.png'],                    rect: {                        w: 25.0,                        h: 25.0,                        x: 0,                        y: 0                    },                    interval: 300                },                title: {                    text: '广场',                    size: 12.0,                    normal: '#696969',                    selected: '#ff0',                    marginB: 6.0,                    ttf: 'Alkatip Basma Tom'                },                rect: {                    w: api.winWidth / 5.0,                    x: 0,                    y: 0,                },            }, {                w: api.winWidth / 5.0,                bg: {                    marginB: 0,                    image: 'rgba(0,0,0,0)',                },                icon: {                    normal: 'widget://res/NVTabBarAnimation/5.png',                    highlight: 'widget://res/NVTabBarAnimation/55.png',                    rect: {                        w: 25.0,                        h: 25.0,                        x: 0,                        y: 0,                    },                },                animationIcons: {                    paths: ['widget://res/NVTabBarAnimation/1.png', 'widget://res/NVTabBarAnimation/2.png', 'widget://res/NVTabBarAnimation/3.png'],                    rect: {                        w: 25.0,                        h: 25.0,                        x: 0,                        y: 0                    },                    interval: 300                },                title: {                    text: '我的',                    size: 12.0,                    normal: '#696969',                    selected: '#ff0',                    marginB: 6.0,                    ttf: 'Alkatip Basma Tom'                },                rect: {                    w: api.winWidth / 5.0,                    x: 0,                    y: 0,                },            }],            selectedIndex: 0        }, function(ret, err) {            if (ret && ret.eventType == "click") {                api.alert({msg: JSON.stringify(ret)});            }        });

中的var NVTabBarAnimation = api.require('NVTabBarAnimation');放在script里吗?
能详细说明一下这个示例代码具体放在哪吗?


没有固定位置,需要根据你的设计架构,一般是放在apiready 里面,也可以封装,建议你还是去学习一下基本知识,这些是基本功。
10
帖子
0
勋章
90
Y币
请问模块开发教程在哪可以看?
BIP734449 · 2023-9-13 22:59请问模块开发教程在哪可以看?

文档中心 这个对你可能有帮助
您需要登录后才可以回帖 登录

本版积分规则