mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-28 18:41:20 -08:00
update docs
This commit is contained in:
1 parent
f7f4899926
commit
292516ab89
48 files changed
+164
-160
No files matched your search
@@ -3,7 +3,7 @@ title: Use with React Portal
|
||||
sidebar_position: 6
|
||||
---
|
||||
|
||||
It is also very easy to use `React Components` in `layers`, `contextmenu`, `controls`, and `setting`. Handle more complex logic through `ReactDOM.createPortal`.
|
||||
It is also very easy to use `React Components` in `layers`, `contextmenu`, `controls`. Handle more complex logic through `ReactDOM.createPortal`.
|
||||
|
||||
👉 [Click to open an online demo](https://codesandbox.io/s/artplayer-react-portal-5z32h)
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ title: 与 React Portal 使用
|
||||
sidebar_position: 6
|
||||
---
|
||||
|
||||
在 layers、contextmenu、controls、setting 里使用 react 组件也是非常容易的事,通过 createPortal 处理更复杂的业务逻辑
|
||||
在 layers、contextmenu、controls 里使用 react 组件也是非常容易的事,通过 createPortal 处理更复杂的业务逻辑
|
||||
|
||||
👉 [点击打开在线演示](https://codesandbox.io/s/artplayer-react-portal-5z32h)
|
||||
|
||||
|
||||
@@ -100,27 +100,30 @@ export default class Setting extends Component {
|
||||
addClass($item, 'art-current');
|
||||
}
|
||||
|
||||
const $icon = document.createElement('div');
|
||||
addClass($icon, 'art-setting-item-left-icon');
|
||||
|
||||
if (item.back) {
|
||||
addClass($item, 'art-setting-item-back');
|
||||
append($left, icons.arrowLeft);
|
||||
append($left, item.html);
|
||||
append($icon, icons.arrowLeft);
|
||||
} else {
|
||||
if (hasChildren) {
|
||||
const $icon = document.createElement('div');
|
||||
addClass($icon, 'art-setting-item-left-icon');
|
||||
append($icon, item.icon || icons.config);
|
||||
append($left, $icon);
|
||||
append($right, icons.arrowRight);
|
||||
} else {
|
||||
append($left, icons.check);
|
||||
append($icon, icons.check);
|
||||
}
|
||||
append($left, item.html);
|
||||
}
|
||||
|
||||
append($left, $icon);
|
||||
append($left, item.html);
|
||||
|
||||
proxy($item, 'click', (event) => {
|
||||
if (hasChildren) {
|
||||
this.init(item.selector);
|
||||
setStyle(this.$parent, 'width', `${item.width || this.width}px`);
|
||||
if (item.width) {
|
||||
setStyle(this.$parent, 'width', `${item.width}px`);
|
||||
}
|
||||
} else {
|
||||
inverseClass($item, 'art-current');
|
||||
if (item.onSelect) {
|
||||
@@ -142,6 +145,7 @@ export default class Setting extends Component {
|
||||
}
|
||||
|
||||
init(option) {
|
||||
setStyle(this.$parent, 'width', `${this.width}px`);
|
||||
if (this.cache.has(option)) {
|
||||
const $panel = this.cache.get(option);
|
||||
inverseClass($panel, 'art-current');
|
||||
@@ -155,6 +159,5 @@ export default class Setting extends Component {
|
||||
this.cache.set(option, $panel);
|
||||
inverseClass($panel, 'art-current');
|
||||
}
|
||||
setStyle(this.$parent, 'width', `${this.width}px`);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user