spz-render
布局
Layouts
跳转到“Layouts”Usage
跳转到“Usage”<spz-render
layout="container"
src="/api/product/similar-products?product_id=&per_page=16"
items="data"
>
<template>
<div>
<!-- ... -->
</div>
</template>
</spz-render>
Attributes
跳转到“Attributes”src
跳转到“src”The value of this attribute can take two forms, one is using an API URL, and the other is using script data. Src attribute usage
manual
跳转到“manual”If this attribute is present, the template doesn’t render at the beginning unless the render
or rerender
action is called.
items
跳转到“items”Get the data from a path in the given data object.
In the following code, if the items
value is "cart"
that will return data.cart
array.
If the items
value is "."
that will return data
object.
const data = {
cart: [ /* ... */ ],
count: 10
};
fixed-min-width
跳转到“fixed-min-width”If this attribute is present, sets the min-width
style for rendered content.
loading
跳转到“loading”The element will be added this attribute when the data is being requested.
finish
跳转到“finish”The element will be added this attribute when the data request is complete.
data-empty
跳转到“data-empty”The element will be added this attribute when the data is empty.
Actions
跳转到“Actions”render
跳转到“render”render([src=<URL | API>])
To request data to render the template. If it has a src
parameter, the src attribute of the element will be reassigned.
rerender
跳转到“rerender”rerender(data=<Object>)
Use the passed data to render the template. It has a parameter:
data
: A data to render the template.
Events
跳转到“Events”event object data
跳转到“event object data”{
"data": { // render data
// ...
},
"originData": { // original data
// ...
}
}
finish
跳转到“finish”Be automatically triggered when the element is rendered.