Query manual
This chapter briefly summarizes the core jsx attributes and syntax rules in Alins. The main purpose is to help developers quickly find how to use Alins. If you are reading this document for the first time, it is recommended to read the specific introduction chapters first to understand the detailed introduction and examples of each attribute and syntax rule.
**The list here contains almost all Alins concepts, so not everything listed here is necessary, and includes some advanced uses of Alins. **
- $mount: used to mount dom elements to specified elements
- Event: The event naming is consistent with the native DOM, such as
onclick, onmousedown
. At the same time, the event value supports js expressions. At this time, you can use the $e variable to access the event object, such asonclick={console.log($e.clientX)}
- Event decorator:
prevent, stop, capture, once, self, pure
, usage method:onclick:stop={console.log(1)}
- $ref: Reference dom element
- $html: Set innerHTML
- $attributes: Use objects to set attributes in batches
- Fragment: DocumentFragment can be created using both empty tags and Frag tags
- Single attribute class name:
class:a={true}
- Single attribute style:
class:color='#f44'
- Lifecycle: $created, $appended, $mounted, $removed
- Two-way binding decorator: Convert the bound data type, such as
value:number={str}
- Component price: The input parameters of the component are props and children
- Logic block:
if, switch
syntax; map function;If, Switch, For, Show, Async
logical components;$show
,$if
,$switch
,$for
,$async
attribute - set syntax sugar: used to set computed set such as:
let b=a+1;set: v=>{a=v-1;}
- watch syntax sugar: monitor data changes, such as:
watch: a, (...args)=>{console.log(args)}
- Attribute abbreviation:
name={name}
is equivalent toname:name
and is equivalent to$name
- Annotation:
@reactive, @static, @shallow, @static-scope
, where @reactive and @static can carry parameters - Tag: $: can declare reactive data, _: can declare static data, static_scope: can declare static scope
- State sharing:
createStore
API - Custom renderer:
useRenderer
,defineRenderer
API