table
-
取消表格中的间隙,用cellspacing="0"
<table cellspacing="0">
<tr style="background-color: white;">
<th style="width: 20%;">序号</th>
<th>学习方式</th>
<th style="width: 25%;">学分</th>
</tr>
<tr v-for="(item,index) in courses" style="background-color: #fafafc">
<td>{{index + 1}}</td>
<td>{{item.method}}</td>
<td style="text-align: right">{{item.score}}</td>
</tr>
</table>
视频
各个元素取值/赋值
input
1.通过id赋值
$("#number").val("123"); //所有带$的都是jquery的,要引入jquery.js
$("#number").attr("value","123");
2.通过name赋值
$("input[name='number']").val("123");
$("input[name='number']").attr("value","123");
本地存储
localStorage
<script type="text/javascript">
var Obj = { name: 'Coffee', sex: 'man' }; //一个js对象
var Json = JSON.stringify(Obj); //将js对象转换成json字符串
var Js = JSON.parse(Json); //json字符串转换成js对象,这里是要新建一个var,而不是用原来的var
</script>
如果微信端存储无效,可以考虑cookie
function setCookie(c_name, value, expiredays) {
var exdate = new Date()
exdate.setDate(exdate.getDate() + expiredays)
document.cookie = c_name + "=" + escape(value) +
((expiredays == null) ? "" : ";expires=" + exdate.toGMTString())
}
//取回cookie
function getCookie(c_name) {
if (document.cookie.length > 0) {
c_start = document.cookie.indexOf(c_name + "=")
if (c_start != -1) {
c_start = c_start + c_name.length + 1
c_end = document.cookie.indexOf(";", c_start)
if (c_end == -1) c_end = document.cookie.length
return unescape(document.cookie.substring(c_start, c_end))
}
}
return ""
}