gpt4 book ai didi

html - 在 ionic 中创建一个表

转载 作者:技术小花猫 更新时间:2023-10-29 11:43:37 26 4
gpt4 key购买 nike

我需要在 Ionic 中创建一个表。我想过使用 ionic 网格,但无法实现我想要的。我怎样才能做到这一点?这是一张类似于我想要的东西的图片:

enter image description here

我可以使用它,但是我怎样才能像图片中那样划分行呢?

<div class="list">

<div class="item item-divider">
Candy Bars
</div>

<a class="item" href="#">
Butterfinger
</a>

...

</div>

最佳答案

flexbox 网格应该做你想做的。您不清楚自己遇到了什么限制,因此很难解决您的具体问题。

这是一个带有工作示例的代码笔,它生成的表格包含前几行和一个标题:http://codepen.io/anon/pen/pjzKMZ

HTML

<html ng-app="ionicApp">

<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">

<title>Ionic Template</title>

<link href="//code.ionicframework.com/nightly/css/ionic.css" rel="stylesheet">
<script src="//code.ionicframework.com/nightly/js/ionic.bundle.js"></script>
</head>

<body ng-controller="MyCtrl as ctrl">
<ion-header-bar class="bar-stable">
<h1 class="title">Service Provider Details</h1>
</ion-header-bar>
<ion-content>
<div class="row header">
<div class="col">Utility Company Name</div>
<div class="col">Service Code</div>
<div class="col">Pay Limit</div>
<div class="col">Account Number to Use</div>
<div class="col"></div>
</div>
<div class="row" ng-repeat="data in ctrl.data">
<div class="col">{{data.name}}</div>
<div class="col">{{data.code}}</div>
<div class="col">LK {{data.limit}}</div>
<div class="col">{{data.account}}</div>
<div class="col"><button class="button" ng-click="ctrl.add($index)">Add</button></div>
</div>
</ion-content>
</body>

</html>

CSS

body {
cursor: url('http://ionicframework.com/img/finger.png'), auto;
}

.header .col {
background-color:lightgrey;
}

.col {
border: solid 1px grey;
border-bottom-style: none;
border-right-style: none;
}

.col:last-child {
border-right: solid 1px grey;
}

.row:last-child .col {
border-bottom: solid 1px grey;
}

Javascript

angular.module('ionicApp', ['ionic'])

.controller('MyCtrl', function($scope) {

var ctrl = this;

ctrl.add = add;
ctrl.data = [
{
name: "AiA",
code: "AI101",
limit: 25000,
account: "Life Insurance"
},
{
name: "Cargills",
code: "CF001",
limit: 30000,
account: "Food City"
}
]

////////
function add(index) {
window.alert("Added: " + index);
}
});

关于html - 在 ionic 中创建一个表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26215355/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com