This chapter mainly introduces the Avalon.config method, which is used to develop some more intimate functions.
In general, when we use ms-controller binding, we need to add a Ms-controller class name to prevent the curly braces from being exposed when the network speed is slow.
<! DOCTYPE html>
The
Double curly braces are also default for Python's well-known templates, and in order to prevent conflicts, we have the need to change the qualifiers. Then we can do this
<! DOCTYPE html>
<!– and –> generate a comment node so that users don't see a mess when the internet is slow. Of course this also has the risk that if the user has defined a lot of comments on the page, there can be confusing problems.
Let's look at a useful configuration item, Debug. Avalon By default is in the console to print no debug messages, on-line we do not want users to see them, you can turn them off.
Avalon.config ({debug:false})
Avalon has its own AMD loader, if you want to use Requirejs or SEAJS, then you have to disable your own loader, or as suggested in the first section, directly in the source to delete it all.
Avalon.config ({loader:false})
In addition, Avalon has two hidden configuration items.
Maxrepeatsize is used to configure the pool size of the proxy nodes generated by the Ms-repeat loop binding in order to reuse these VM objects. The default is 100. The memory on the phone is more serious, you can adjust this threshold point less.
Avalon.config ({lmaxrepeatsize:40})
Dettachvmodels is the decision to add a $vmodels, $vmodel property on the This object bound by the event. Previously added by default, now is not added by default, this is due to CG recycling considerations. And under Ie6-8, adding the $vmodels property for an element does not know why it throws an exception. See Source:
$vmodels, $vmodel should be little known, let's not care about them. This configuration item will also be removed in 1.36.
Mini MVVM Framework Avalonjs Learning Tutorial 17, some configuration items for Avalon