English
openCustomComponent
About 182 wordsLess than 1 minute
2025-04-28
This method allows you to open a custom mini program component.
FxUI.userDefine.openCustomComponent(options: Object)Parameters
| Parameter | Description | Type | Optional Values | Default |
|---|---|---|---|---|
| components | Component | array/object | — | — |
| type | Display mode: ShowCenter for centered dialog, FullScreen for full-screen display | string | ShowCenter/FullScreen | FullScreen |
| width | Width (effective in centered dialog mode) | string | — | '' |
| height | Height (effective in centered dialog mode) | string | — | '' |
When components is an object:
| Parameter | Description | Type | Optional Values | Default |
|---|---|---|---|---|
| apiName (required) | Component apiName | string | - | — |
| params (optional) | Other component parameters | string | - | — |
| url (optional) | Compressed component URL | string | - | '' |
Code Example
import FxUI from 'fxui-mobile';
FxUI.userDefine.openCustomComponent({
components:[{
"apiName":"component_AYPWh__c",
params: { // custom parameters
customParam: {}
},
"url": "" // Providing the component URL can save one interface call
}]
}).then((res) => {
// Data returned by the custom component
})Or:
import FxUI from 'fxui-mobile';
FxUI.userDefine.openCustomComponent({
component:{
"apiName":"component_AYPWh__c",
params: { // custom parameters
customParam: {}
},
"url": "" // Providing the component URL can save one interface call
}
}).then((res) => {
// Data returned by the custom component
})Receiving the params parameter:
properties: {
context: {
type: Object,
value: {},
},
},
// ...
attached() {
// Get custom parameters
console.log(this.data.context.params)
}