Skip to content

update 只需填写需要更新的值#549

Merged
zhw2590582 merged 1 commit into
zhw2590582:masterfrom
xifangczy:function-update-optimize
Jun 2, 2023
Merged

update 只需填写需要更新的值#549
zhw2590582 merged 1 commit into
zhw2590582:masterfrom
xifangczy:function-update-optimize

Conversation

@xifangczy

Copy link
Copy Markdown
Contributor

目前要制作一个动态的 controls 相当繁琐
如果update只需要更新想要更新的部分,那就方便很多

var art = new Artplayer({
    container: '.artplayer-app',
    url: '/assets/sample/video.mp4',
    controls: [
        {
            name: 'loopBtn',
            index: 1,
            html: `<i class="art-icon">开启循环</i>`,
            tooltip: '开启循环',
            position: 'right',
            click: function () {
                art.option.loop = !art.option.loop;
                const tip = art.option.loop ? "关闭循环" : "开启循环";
                art.controls.update({
                    name: 'loopBtn',
                    html: `<i class="art-icon">${tip}</i>`,
                    tooltip: tip
                });
            }
        },
    ],
});

这样更符合逻辑吧?

@vercel

vercel Bot commented Jun 1, 2023

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
art-player ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 1, 2023 0:10am

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants