【飞阅】XML中常用JS代码块

前端之家收集整理的这篇文章主要介绍了【飞阅】XML中常用JS代码块前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

常用代码.xml


<?xml version="1.0" encoding="UTF-8"?>
<component xmlns:cl="http://www.flyread.com.cn/columnLabel"
           xmlns:cp="http://www.flyread.com.cn/columnPanel"
           xmlns="http://www.flyread.com.cn/node">
    <define name="magazineBook" id="magazineBook" container="true"
            namespace="http://www.flyread.com.cn/magazineWindow"/>
    <import refId="columnLabel" funcName="ColumnLabel"/>
    <import refId="columnPanel" funcName="ColumnPanel"/>

    <script>
        <![CDATA[
        var rowNum = args.rowNum;
        var tableId = args.tableId;
        ]]>
    </script>
    <node funcRef="ColumnPanel" varName="magazineBook">
        <cp:args width="$magazineBook.width" height="$magazineBook.height" baseCls="$magazineBook.baseCls"
                 cls="$magazineBook.cls" layout="$magazineBook.layout" margins="$magazineBook.margins"
                 listeners="$magazineBook.listeners"/>
        <subs>
            <script>
                <![CDATA[
                    if (fatherId) {
                    tempArgs = {};
                    tempArgs["parent"] = Ext.getCmp(fatherId);
                    Ext.getCmp(fatherId).addObject(magazineBook,tempArgs);
                    }

                    magazineBook.MetadataId = args.MetadataId;

                    if(args.orderId){
                    magazineBook.orderId = args.orderId;
                    }

                    Ext.getCmp("catalogSetCard").layout.setActiveItem("catalogSetCard01");
                ]]>
            </script>
            <!-- todo 绑定renderFn clickFn-->
            <node funcRef="ColumnPanel" varName="magazineBook01Panel">
                <cp:args columnNum="2" baseCls="$magazineBook02Panel.baseCls"
                         height="$magazineBook02Panel.height" width="$magazineBook02Panel.width"
                         cls="$magazineBook02Panel.cls"/>
                <subs>
                    <node funcRef="ColumnPanel" varName="completeCardContent01Table">
                        <cp:args baseCls="$completeCardContent01Table.baseCls" cls="$completeCardContent01Table.cls"
                                 height="$completeCardContent01Table.height"
                                 autoScroll="$completeCardContent01Table.autoScroll"/>
                    </node>
                    <node funcRef="ColumnLabel" varName="bookOrderBtn">
                        <cl:args columnNum="12" width="$bookOrderBtn.width"
                                 height="$bookOrderBtn.height"
                                 cls="$bookOrderBtn.cls" margins="$bookOrderBtn.margins"
                                 clickFn="$bookOrderBtn.clickFn"/>
                    </node>
                    <script>
                        <![CDATA[
                           Ext.ux.addClickFn(bookOrderBtn);
                           args.completeCardContent01Table.renderFn();
                        ]]>
                    </script>
                </subs>
            </node>

            <!-- todo 限制字符串长度,超出部分显示为省略号-->
            <node funcRef="ColumnPanel" varName="magazineBook02Panel">
                <cp:args columnNum="2" baseCls="$magazineBook02Panel.baseCls"
                         height="$magazineBook02Panel.height" width="$magazineBook02Panel.width"
                         cls="$magazineBook02Panel.cls"/>
                <subs>
                    <node funcRef="ColumnLabel" varName="magazineBook02Panel01">
                        <cl:args columnNum="21" cls="$magazineBook02Panel01.cls"
                                 tableField="$magazineBook02Panel01.tableField"/>
                    </node>
                    <script>
                        <![CDATA[
                            var oldText = magazineBook02Panel01.text;
                            if (oldText.length > 6) {
                              var newText = oldText.substring(0,5)+"...";
                              magazineBook02Panel01.setText(newText);
                            }
                        ]]>
                    </script>
                    <node funcRef="ColumnLabel" varName="magazineBook02Panel02">
                        <cl:args columnNum="22" cls="$magazineBook02Panel02.cls"
                                 tableField="$magazineBook02Panel02.tableField"/>
                    </node>
                </subs>
            </node>

            <!-- todo 加载完成后修改显示值-->
            <node funcRef="ColumnPanel" varName="magazineBook03Panel">
                <cp:args columnNum="2" baseCls="$magazineBook02Panel.baseCls"
                         height="$magazineBook02Panel.height" width="$magazineBook02Panel.width"
                         cls="$magazineBook02Panel.cls"/>
                <subs>
                    <node funcRef="ColumnLabel" varName="magazineBook05">
                        <cl:args columnNum="5" tableField="$magazineBook05.tableField"
                                 x="$magazineBook05.x" y="$magazineBook05.y"
                                 height="$magazineBook05.height" width="$magazineBook05.width"
                                 cls="$magazineBook05.cls"/>
                    </node>
                    <script>
                        <![CDATA[
                            var priceText = magazineBook05.text;
                            var priceFormat = "¥" + (Number(priceText)/100);
                            magazineBook05.setText(priceFormat);
                        ]]>
                    </script>
                </subs>
            </node>

        </subs>
    </node>
</component>
原文链接:https://www.f2er.com/xml/294625.html

猜你在找的XML相关文章