前端请求映射, 但不需要返回数据时:
location.href="alipay?oid="+oid+"&total="+total;
axios语法:
axios.get(url).then(function(response) {
});
axios.post(url,data).then(function(response){
});
axios.delete(url).then(function (response) {
);
axios.put(url, data).then(function(response){
});
页面引用:
<div th:replace="include/fore/top::html" ></div>
<div th:include="include/fore/top::html" ></div>
其中 th:replace 是包括标签和内容全部换成你引用的内容
th:include 是只替换标签中的内容
<div th:fragment="html">.............</div>
标签条件选择:
var price= $("span.orderItemPromotePrice[pid=2]").text();
a[orderStatus]
鼠标事件:
$("div.deleteOrderItem").click(function(){
});
键盘事件:
$(".orderItemNumberSetting").keyup(function(){
});
获取(修改)文本text值(不是标签属性值 ):
var name= $("#name").text();
var name= $("#name").text("修改的内容");
获取标签(任意)属性值(并改变属性的值):
var oiid = $(this).attr("oiid")
var oiid = $("#email").attr("oiid")
$("img.selectAllItem").attr("src","img/site/cartNotSelected.png");
获取标签value属性:
var num= $(".orderItemNumberSetting").val();
获取和插入数据(html):
$("#name").html()
$("#name").html("需要赋予的值")
获取标签固有属性:
var str7 = $("#link1").prop("action");
隐藏标签:
$("tr.cartProductItemTR[oiid="+deleteOrderItemid+"]").hide()
遍历同类名(class)的标签:
$(".cartProductItemIfSelected").each(function(){
if("selectit"==$(this).attr("selectit")){
}
});
vue.pageInfo.content.forEach(function(value, i){
if(value.name.length>6){
value.name = value.name.substring(0,6) + "...";
alert(value.name);
}
});
改变 css 样式:
$("button.createOrderButton").css("background-color","#C40000");
删除标签属性:
$("button.createOrderButton").removeAttr("disabled");
字符串截取:
params = params.substring(1);
字符串中替换某些字符:
str.replace(/Microsoft/, "W3School")
str.replace(/Microsoft/g, "W3School")
字符串转化成整数类型(比较大小):
var number = parseInt(num);
判断该变量是否为数字:
if(isNaN(num)){
}