unique key
is needed to specify the resource to the component:
uri
parameter during its preloading. When rendering, pass this key to the src attribute of the <image />
component, allowing the component to locate the resource.data
A collection that describes all the details of the resources to be preloaded, its keys are defined as follows:
data
: Type array
, each item inside the array corresponds to a resource. The keys for each item are defined as follows:
uri
: Type string
, represents the CDN address of the resource.type
: Type string
, represents the type of resource. The defined types of resources are as follows:
image
: Image resource. (api/elements/built-in/image.html#trailnewimage--) switch for the Image component to preload images.)video
: Video resource.audio
: Audio resource.params
(optional): Custom control parameters for resource preloading, the supported parameters are as follows:
priority
(optional): Only for image
type resources. Indicates network request priority. If the priority is high, other image requests will be blocked while the image library preloads these images, which may slow down the display of other images. Therefore, if these preloaded images are not immediately needed for display, consider setting a lower priority. The options supported are as follows:
high
: High priority.medium
: Medium priority.low
: Low priority, this is the default value.cacheTarget
(optional): Only for image
type resources. Indicates the form in which resources are saved. The options supported are as follows:
disk
: Resource is saved to disk after preloading is completed, this is the default value.bitmap
: Resource is decoded into a bitmap and saved in memory after preloading. (Note: Currently, Android bitmap caching is not yet effective.)preloadKey
: Only for video
, audio
type resources. Represents a unique key that identifies the resource. When rendering the <x-video-pro> component, this key must be specified so that the component can find the preloaded cache. This is a required parameter.size
(optional): Only for video
type resources. Indicates the size of the preload, with a default value of 500 * 1024 (bytes).callback
The callback function called after the API is executed or fails. The inside definition of its parameters is as follows:
code
: Type number
, status code, which may take the following values:
0
: Success.11001
: Parameter error.msg
: Type string
, a global error message.details
: Type array
, where each detail represents the preload status details of a resource, with the internal definition of detail as follows:
code
: Type number
, status code, which may take the following values:
0
: Success.11001
: Parameter error.msg
: Type string
, error message.uri
: Type string
, represents the CDN address of the resource.type
: Type string
, represents the type of the resource, with resource types defined as follows:
image
: Image resource.video
: Video resource.audio
: Audio resource.None (undefined
).
code
will return the 11001
error code, and the msg
will contain detailed error information.