直播平台发现组件、艺人动态展示、点击切换艺人

直播平台发现组件使用步骤:

1. 查找插件

进入插件市场:打开 HBuilderX 编辑器,点击菜单栏中的 "插件" -> "插件市场",或者直接访问uni-app 插件市场官网 。 搜索插件:在插件市场的搜索框中输入关键词,查找本插件,比如搜索 "小程序对接视频号" 。 筛选插件:筛选出小程序对接视频号插件。

2. 安装插件

方式一:在 HBuilderX 中安装 在插件市场找到目标插件后,点击进入插件详情页。 点击 "使用 HBuilderX 导入插件" 按钮(如果是免费插件,直接导入;如果是付费插件,需要先购买 )本插件是免费免费的喽。 选择要导入插件的 uni-app 项目,确认导入。导入成功后,插件会被放置在项目的 uni_modules 目录下。 方式二:通过命令行安装(适用于发布到 npm 的插件) 打开命令行工具,进入你的 uni-app 项目根目录。 执行 npm install 插件名称 命令,例如 npm install my-uniapp-plugin 。安装完成后,同样可以在项目的 uni_modules 目录下找到该插件。

3. 引入插件

ini 复制代码
```javascript
<liveStreamDiscoverVue 
:centerAvatar="centerAvatar"
:centerName="centerName"
:circleItems="circleItems" 
:bottomNavs="bottomNavs" />
```

4 在测试项目中加入数据,可以根据需要从后台获取,增加动画处理函数。

javascript 复制代码
const centerAvatar = ref('/static/discover/1.png');
const centerName = ref('柳欢欢');

const circleItems = ref([{
            type: 'avatar',
            src: '/static/discover/2.png',
            name: 'Jimly',
            active: false,
            x: 0,
            y: -210,
            yOffset: 0
        },
        {
            type: 'avatar',
            src: '/static/discover/3.png',
            name: '李妮娜',
            active: false,
            x: -130,
            y: -80,
            yOffset: 0
        },
        {
            type: 'avatar',
            src: '/static/discover/4.png',
            name: '王朵朵',
            active: false,
            x: 130,
            y: -120,
            yOffset: 0
        },
        {
            type: 'tag',
            text: '年轻',
            count: '12345人',
            active: false,
            x: -160,
            y: 50,
            yOffset: 0
        },
        {
            type: 'tag',
            text: '天然萌',
            count: '12345人',
            active: false,
            x: 160,
            y: 60,
            yOffset: 0
        },
        {
            type: 'tag',
            text: '可爱',
            count: '12345人',
            active: false,
            x: -80,
            y: 90,
            yOffset: 0
        },
        {
            type: 'tag',
            text: '大胸',
            count: '12345人',
            active: false,
            x: 80,
            y: 80,
            yOffset: 0
        },
        {
            type: 'avatar',
            src: '/static/discover/5.png',
            name: '肖媚媚',
            active: false,
            x: -130,
            y: 200,
            yOffset: 0
        },
        {
            type: 'avatar',
            src: '/static/discover/6.png',
            name: 'KaiTi',
            active: false,
            x: 120,
            y: 200,
            yOffset: 0
        },
    ]);

    const bottomNavs = ref([{
            text: '现场',
            icon: '/static/discover/live.png',
            activeIcon: '/static/discover/live_.png'
        },
        {
            text: '艺人',
            icon: '/static/discover/artist.png',
            activeIcon: '/static/discover/artist_.png'
        },
        {
            text: '发现',
            icon: '/static/discover/discover.png',
            activeIcon: '/static/discover/discover_.png'
        },
        {
            text: '我的',
            icon: '/static/discover/my.png',
            activeIcon: '/static/discover/my_.png'
        },
    ]);

    // 动画相关
    const animateCircleItems = () => {
        setInterval(() => {
           circleItems.value.forEach((item, index) => {
            const yOffset = Math.sin((Date.now() / 1000 + index) * 2) * 10; // 计算上下移动的偏移量,可调整参数改变动画效果
            item.yOffset = yOffset;
           });
          }, 16);
    };
    animateCircleItems();
相关推荐
o***Z4481 小时前
前端性能优化案例
前端
张拭心1 小时前
前端没有实际的必要了?结合今年工作内容,谈谈我的看法
前端·ai编程
姜太小白2 小时前
【前端】CSS媒体查询响应式设计详解:@media (max-width: 600px) {……}
前端·css·媒体
HIT_Weston2 小时前
39、【Ubuntu】【远程开发】拉出内网 Web 服务:构建静态网页(二)
linux·前端·ubuntu
百***06012 小时前
SpringMVC 请求参数接收
前端·javascript·算法
天外天-亮2 小时前
Vue + excel下载 + 水印
前端·vue.js·excel
起个名字逛街玩2 小时前
前端正在走向“工程系统化”:从页面开发到复杂产品架构的深度进化
前端·架构
用户47949283569152 小时前
React 渲染两次:是 Bug 还是 Feature?聊聊严格模式的“良苦用心”
前端·react.js·前端框架
b***74883 小时前
前端GraphQL案例
前端·后端·graphql
云飞云共享云桌面3 小时前
无需配置传统电脑——智能装备工厂10个SolidWorks共享一台工作站
运维·服务器·前端·网络·算法·电脑