mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-24 06:31:20 -08:00
update docs
This commit is contained in:
1 parent
d9cad3ef85
commit
fe88ab30d3
3 files changed
+139
-248
No files matched your search
@@ -3,7 +3,7 @@ title: Handle a single component
|
||||
sidebar_position: 3
|
||||
---
|
||||
|
||||
When we add custom components in `layers`, `contextmenu`, `controls`, `setting`, It is best to add a `name` property that is used to position the DOM element of the component.
|
||||
When we add custom components in `layers`, `contextmenu`, `controls`, It is best to add a `name` property that is used to position the DOM element of the component.
|
||||
|
||||
Here are three ways to get the DOM element of the component: component method `mounted`, instance method `query`, recommended through `name` direct acquisition.
|
||||
|
||||
@@ -42,25 +42,15 @@ art.on('ready', () => {
|
||||
}
|
||||
});
|
||||
|
||||
art.setting.add({
|
||||
name: 'setting1',
|
||||
html: 'your-setting',
|
||||
mounted: function($setting1) {
|
||||
//
|
||||
}
|
||||
});
|
||||
|
||||
// Use the query method to get the DOM element of the component
|
||||
var $layer1 = art.query('.art-layer-layer1');
|
||||
var $contextmenu1 = art.query('.art-contextmenu-contextmenu1');
|
||||
var $control1 = art.query('.art-control-control1');
|
||||
var $setting1 = art.query('.art-setting-setting1');
|
||||
|
||||
// Recommended use the name to get the DOM element of the component
|
||||
var $layer1 = art.layers['layer1'];
|
||||
var $contextmenu1 = art.contextmenu['contextmenu1'];
|
||||
var $control1 = art.controls['control1'];
|
||||
var $setting1 = art.setting['setting1'];
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
Reference in new issue
Block a user