希望新手能少走弯路,与君共勉
参考文献:
https://www.jb51.net/article/46252.htm
<script type="text/javascript">
$(document).ready(function(){
//权限写死,后台之后会再加
var op = 3;
console.log(op);
alert(op);
if (op==1) {
$("#b").attr("disabled", true);
$("#c").attr("disabled", true);
$("#d").attr("disabled", true);
}
if (op==2) {
$("#d").attr("disabled", true);
}
});
</script>
<body>
<div>
<button id="a" type="button" class="btn btn-w-m btn-primary" onclick="as();">新增</button>
<button id="b" type="button" class="btn btn-w-m btn-primary" onclick="as();">删除</button>
<button id="c" type="button" class="btn btn-w-m btn-primary" onclick="as();">修改</button>
<button id="d" type="button" class="btn btn-w-m btn-primary" onclick="as();">查询</button>
</div>
</body>
(上面的class按钮要引入特定的包,可以删除换自己的样式)
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
js:
function as() {
alert("anlog");
}