springboot怎么把数据传给前端:springboot 如何引入前端 bootstrap?
这种问题网上一搜一大堆,你可以具体找一篇文章试试,遇到问题可以针对相关问题去提问。springboot通过jar包方式引入bootstrap_个人文章 - SegmentFault 思否 这不是查查就
顺晟科技
2022-10-19 11:53:36
199
我需要根据单元格上的值更改行的类。
例如,如果某一行在奖金列中包含文本级别1,则整行应属于“bg-info”类。
并且如果一行在奖金列中包含文本级别2,则整行应属于“BG-Warning”类。
我尝试更改行的颜色,但无法将背景颜色类应用到。
到目前为止,这是我的代码..
<html>
<head>
<title>Dkin Pizza Shops</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css"
integrity="sha384-B0vP5xmATw1+K9KRQjQERJvTumQW0nPEzvF6L/Z6nronJ3oUOFUFpCjEUQouq2+l"
crossorigin="anonymous"
>
<script type="text/javascript" src="storeData.js"></script>
<script>
function buildTable()
{
let outputText = '';
for (var i = 0; i < storeData.length; i++)
{
let store = storeData[i];
outputText += "<tr>";
outputText += "<td>" + store.city + "</td>";
outputText += "<td>" + store.postcode + "</td>";
outputText += "<td>" + findState(store.postcode) + "</td>";
outputText += "<td>" + store.manager + "</td>";
outputText += "<td>" + store.sales + "</td>";
outputText += "<td>" + findBonus(store.sales) + "</td>";
outputText += "<tr>"
}
document.getElementById("tableBody").innerHTML = outputText;
return;
}
function findState(postcode)
{
var postcode = parseInt(postcode,10);
if((postcode>=2000 && postcode<=2599)|| (postcode>=2619 && postcode<=2898) || (postcode>=2921 && postcode<=2999))
{return "NSW";}
else if((postcode>=2600 && postcode<=2618)|| (postcode>=2900 && postcode<=2920))
{return "ACT";}
else if((postcode>=3000 && postcode<=3999))
{return "VIC";}
else if((postcode>=4000 && postcode<=4999))
{return "QLD";}
else if((postcode>=5000 && postcode<=5799))
{return "SA";}
else if((postcode>=6000 && postcode<=6797))
{return "WA";}
else if((postcode>=7000 && postcode<=7799))
{return "TAS";}
else if((postcode>=0800 && postcode<=0899))
{return "NT";}
return '';
}
function findBonus(sales)
{
var sales = parseInt(sales,10);
if(sales>=2500 && sales<=5499)
{return "Level 1"}
else if(sales>=5500)
{return "Level 2"}
return '';
}
</script>
</head>
<body>
<div class="container">
<h1>Shop Sales</h1>
<h3>Total sales by shop for June 2015</h3>
<table class="table table-sm" id="shops">
<thead>
<tr>
<th>City</th>
<th>Postcode</th>
<th>State</th>
<th>Manager</th>
<th>Sold</th>
<th>Bonus</th>
</tr>
</thead>
<tbody id="tableBody">
<tr>
<td></td>
</tr>
</tbody>
</table>
<script>buildTable()</script>
</div>
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"
integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj"
crossorigin="anonymous">
</script>
<script
src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/js/bootstrap.bundle.min.js"
integrity="sha384-Piv4xVNRyMGpqkS2by6br4gNJ7DXjqk09RmUpJ8jgGtD7zP9yug3goQfGII0yAns"
crossorigin="anonymous">
</script>
</body>
顺晟科技:
您可以在邮政编码和售后之后再添加两个类似的列。 不要忘记在这些新列的thead部分中添加th
<html>
<head>
<title>Dkin Pizza Shops</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css"
integrity="sha384-B0vP5xmATw1+K9KRQjQERJvTumQW0nPEzvF6L/Z6nronJ3oUOFUFpCjEUQouq2+l"
crossorigin="anonymous"
>
<script type="text/javascript" src="storeData.js"></script>
<script>
function buildTable()
{
let outputText = '';
for (var i = 0; i < storeData.length; i++)
{
let store = storeData[i];
outputText += "<tr>";
outputText += "<td>" + store.city + "</td>";
outputText += "<td>" + store.postcode + "</td>";
outputText += "<td>" + findState(store.postcode) + "</td>";
outputText += "<td>" + store.manager + "</td>";
outputText += "<td>" + store.sales + "</td>";
outputText += "<td>" + findBonus(store.sales) + "</td>";
outputText += "<tr>"
}
document.getElementById("tableBody").innerHTML = outputText;
return;
}
function findState(postcode)
{
var postcode = parseInt(postcode,10);
if((postcode>=2000 && postcode<=2599)|| (postcode>=2619 && postcode<=2898) || (postcode>=2921 && postcode<=2999))
{return "NSW";}
else if((postcode>=2600 && postcode<=2618)|| (postcode>=2900 && postcode<=2920))
{return "ACT";}
else if((postcode>=3000 && postcode<=3999))
{return "VIC";}
else if((postcode>=4000 && postcode<=4999))
{return "QLD";}
else if((postcode>=5000 && postcode<=5799))
{return "SA";}
else if((postcode>=6000 && postcode<=6797))
{return "WA";}
else if((postcode>=7000 && postcode<=7799))
{return "TAS";}
else if((postcode>=0800 && postcode<=0899))
{return "NT";}
return '';
}
function findBonus(sales)
{
var sales = parseInt(sales,10);
if(sales>=2500 && sales<=5499)
{return "Level 1"}
else if(sales>=5500)
{return "Level 2"}
return '';
}
</script>
</head>
<body>
<div class="container">
<h1>Shop Sales</h1>
<h3>Total sales by shop for June 2015</h3>
<table class="table table-sm" id="shops">
<thead>
<tr>
<th>City</th>
<th>Postcode</th>
<th>State</th>
<th>Manager</th>
<th>Sold</th>
<th>Bonus</th>
</tr>
</thead>
<tbody id="tableBody">
<tr>
<td></td>
</tr>
</tbody>
</table>
<script>buildTable()</script>
</div>
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"
integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj"
crossorigin="anonymous">
</script>
<script
src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/js/bootstrap.bundle.min.js"
integrity="sha384-Piv4xVNRyMGpqkS2by6br4gNJ7DXjqk09RmUpJ8jgGtD7zP9yug3goQfGII0yAns"
crossorigin="anonymous">
</script>
</body>
要在行中添加颜色,请尝试以下操作
<html>
<head>
<title>Dkin Pizza Shops</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css"
integrity="sha384-B0vP5xmATw1+K9KRQjQERJvTumQW0nPEzvF6L/Z6nronJ3oUOFUFpCjEUQouq2+l"
crossorigin="anonymous"
>
<script type="text/javascript" src="storeData.js"></script>
<script>
function buildTable()
{
let outputText = '';
for (var i = 0; i < storeData.length; i++)
{
let store = storeData[i];
outputText += "<tr>";
outputText += "<td>" + store.city + "</td>";
outputText += "<td>" + store.postcode + "</td>";
outputText += "<td>" + findState(store.postcode) + "</td>";
outputText += "<td>" + store.manager + "</td>";
outputText += "<td>" + store.sales + "</td>";
outputText += "<td>" + findBonus(store.sales) + "</td>";
outputText += "<tr>"
}
document.getElementById("tableBody").innerHTML = outputText;
return;
}
function findState(postcode)
{
var postcode = parseInt(postcode,10);
if((postcode>=2000 && postcode<=2599)|| (postcode>=2619 && postcode<=2898) || (postcode>=2921 && postcode<=2999))
{return "NSW";}
else if((postcode>=2600 && postcode<=2618)|| (postcode>=2900 && postcode<=2920))
{return "ACT";}
else if((postcode>=3000 && postcode<=3999))
{return "VIC";}
else if((postcode>=4000 && postcode<=4999))
{return "QLD";}
else if((postcode>=5000 && postcode<=5799))
{return "SA";}
else if((postcode>=6000 && postcode<=6797))
{return "WA";}
else if((postcode>=7000 && postcode<=7799))
{return "TAS";}
else if((postcode>=0800 && postcode<=0899))
{return "NT";}
return '';
}
function findBonus(sales)
{
var sales = parseInt(sales,10);
if(sales>=2500 && sales<=5499)
{return "Level 1"}
else if(sales>=5500)
{return "Level 2"}
return '';
}
</script>
</head>
<body>
<div class="container">
<h1>Shop Sales</h1>
<h3>Total sales by shop for June 2015</h3>
<table class="table table-sm" id="shops">
<thead>
<tr>
<th>City</th>
<th>Postcode</th>
<th>State</th>
<th>Manager</th>
<th>Sold</th>
<th>Bonus</th>
</tr>
</thead>
<tbody id="tableBody">
<tr>
<td></td>
</tr>
</tbody>
</table>
<script>buildTable()</script>
</div>
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"
integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj"
crossorigin="anonymous">
</script>
<script
src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/js/bootstrap.bundle.min.js"
integrity="sha384-Piv4xVNRyMGpqkS2by6br4gNJ7DXjqk09RmUpJ8jgGtD7zP9yug3goQfGII0yAns"
crossorigin="anonymous">
</script>
</body>
05
2022-12
02
2022-12
02
2022-12
29
2022-11
29
2022-11
24
2022-11