前端簡單使用的一些東西(自用)

一 icon:

<link rel="icon" href="../assets/images/favicon.ico" type="image/x-icon" />

二 背景圖片(使用style進行 添加)

style="background-image: url(../assets/images/img_bg_1.jpg);"

三 關於元素錯誤-兩個相同元素:

Malformed markup: Attribute "aos-duration" appears more than once in element
有一個元素錯誤:
2020-03-09 16:03:22.070 [,] [http-nio-8080-exec-1] ERROR o.a.c.c.C.[.[.[.[dispatcherServlet] - [log,182] - Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.thymeleaf.exceptions.TemplateInputException: An error happened during template parsing (template: "class path resource [templates/index.html]" - line 38, col 163)] with root cause
org.attoparser.ParseException: (Line = 38, Column = 163) Malformed markup: Attribute "aos-duration" appears more than once in element

原文:
<div class="header w1200 clearfix">
<a class="logo fl" href="javascript:;" title="這裏是您的網站名稱" 
aos="fade-right" aos-easing="ease"
 aos-duration="700" aos-delay="100" aos-duration="700">

這裏的aos-duration元素出現了兩次 導致啓動時候報錯。注意themleaf在解析前端在同一個標籤是可能不支持兩個相同名的元素

四 百度地圖html 代碼

    <!--地圖開始-->
                    <script type="text/javascript"
                            src="http://api.map.baidu.com/api?v=2.0&ak=OfldXkI591GW281wpaUBSHES"></script>
                    <style type="text/css">
                        #allmap {
                            width: 100%;
                            height: 400px;
                            margin-top: 20px;
                            overflow: hidden;
                            font-family: "微軟雅黑";
                        }

                        #allmap b {
                            color: #CC5522;
                            font-size: 14px;
                        }

                        #allmap img {
                            max-width: none;
                        }
                    </style>
                    <div id="allmap"></div>
                    <script type="text/javascript">
                        var map = new BMap.Map("allmap");
                        map.centerAndZoom(new BMap.Point(111.2222225, 30.300000), 18);
                        var marker1 = new BMap.Marker(new BMap.Point(111.222222, 30.300000));  // 創建標註
                        map.addOverlay(marker1);              // 將標註添加到地圖中
                        //marker1.setAnimation(BMAP_ANIMATION_BOUNCE); //跳動的動畫
                        //創建信息窗口
                        var infoWindow1 = new BMap.InfoWindow("<b>你的地址<br>電話:+86 0000 1111");
                        marker1.openInfoWindow(infoWindow1);
                        //marker1.addEventListener("click", function(){this.openInfoWindow(infoWindow1);});
                        //向地圖中添加縮放控件
                        var ctrl_nav = new BMap.NavigationControl({
                            anchor: BMAP_ANCHOR_TOP_LEFT,
                            type: BMAP_NAVIGATION_CONTROL_LARGE
                        });
                        map.addControl(ctrl_nav);
                        //向地圖中添加縮略圖控件
                        var ctrl_ove = new BMap.OverviewMapControl({anchor: BMAP_ANCHOR_BOTTOM_RIGHT, isOpen: 1});
                        map.addControl(ctrl_ove);
                        //向地圖中添加比例尺控件
                        var ctrl_sca = new BMap.ScaleControl({anchor: BMAP_ANCHOR_BOTTOM_LEFT});
                        map.addControl(ctrl_sca);

                        map.enableDragging();//啓用地圖拖拽事件,默認啓用(可不寫)
                        map.enableScrollWheelZoom();//啓用地圖滾輪放大縮小
                        map.enableDoubleClickZoom();//啓用鼠標雙擊放大,默認啓用(可不寫)
                        map.enableKeyboard();//啓用鍵盤上下左右鍵移動地
                    </script>
                    <!--地圖結束--></div>

五:關於freemarker空指針報錯的問題:

如果我們在ftl取得值還未賦值。會報錯異常 

解決方法:

 var xxxx = ${(RequestParameters.xxx)!};

而當您寫成這樣的時候:${RequestParameters.xxx!}  沒值的時候依然會報錯,
 ${(RequestParameters.xxx)!};

前端依舊會有個爲空的值

當然這樣就比較好處理了。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章