angular - 显示当前时间 - 小时和分钟
问题描述
我想在显示屏上显示当前时间(小时和分钟)。就性能而言,我怎样才能最有效地做到这一点。我正在使用这种技术来解决我的问题。请帮我
time: function (data: any) {
debugger
console.log(`Now`);
// formatDate(date: any, format: string): string { return moment.utc(date.toString()).local().format(format); }
return {
field: '<input class="form-control" type="time" value="13:30"/>',
// field: '<input class="form-control" type="datetime" #RequiredByDate name="RequiredByDate" [value]="formatDate(hitchRequest.requiredByDate)">',
};
解决方案
我不知道你所说的三列是什么意思。我像这样改变了你的内部网格
<Grid Padding="10" RowSpacing="10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="50" />
<RowDefinition Height="50" />
<RowDefinition Height="50" />
<RowDefinition Height="50" />
</Grid.RowDefinitions>
<StackLayout Grid.Row="0" Grid.Column="0" HorizontalOptions="FillAndExpand" Orientation="Vertical">
<Label Text="ID Type" FontSize="Small" TextColor="#757575" HorizontalOptions="CenterAndExpand"/>
<Label x:Name="genrealsectionforreadonlylblIdType" Text="NIC" FontSize="Small" TextColor="black" HorizontalOptions="CenterAndExpand" />
</StackLayout>
<StackLayout Grid.Row="0" Grid.Column="1" HorizontalOptions="FillAndExpand" Orientation="Vertical">
<Label Text="ID Number" FontSize="Small" TextColor="#757575" HorizontalOptions="CenterAndExpand"/>
<Label x:Name="genrealsectionforreadonlylblIdNumber" Text="65125457V" FontSize="Small" TextColor="Black" HorizontalOptions="CenterAndExpand" />
</StackLayout>
<StackLayout Grid.Row="0" Grid.Column="2" HorizontalOptions="FillAndExpand" Orientation="Vertical">
<Label x:Name="lblIdNumberNew" Text="ID Number(New)" FontSize="Small" TextColor="#757575" HorizontalOptions="CenterAndExpand" />
<Label x:Name="genrealsectionforreadonlylblOldNic" Text="15665544" FontSize="Small" TextColor="Black" HorizontalOptions="CenterAndExpand" />
</StackLayout>
<StackLayout Grid.Row="1" Grid.Column="0" HorizontalOptions="FillAndExpand" Orientation="Vertical">
<Label Text="Title" FontSize="Small" TextColor="#757575" HorizontalOptions="CenterAndExpand"/>
<Label x:Name="genrealsectionforreadonlylblTitle" Text="MS" FontSize="Small" TextColor="Black" HorizontalOptions="CenterAndExpand" />
</StackLayout>
<StackLayout Grid.Row="1" Grid.Column="1" HorizontalOptions="FillAndExpand" Orientation="Vertical">
<Label Text="First name" FontSize="Small" TextColor="#757575" HorizontalOptions="CenterAndExpand"/>
<Label x:Name="genrealsectionforreadonlylblFname" Text="TEST" FontSize="Small" TextColor="Black" HorizontalOptions="CenterAndExpand" />
</StackLayout>
<StackLayout Grid.Row="1" Grid.Column="2" HorizontalOptions="FillAndExpand" Orientation="Vertical">
<Label Text="Last name" FontSize="Small" TextColor="#757575" HorizontalOptions="CenterAndExpand"/>
<Label x:Name="genrealsectionforreadonlylblLname" Text="TEST1" FontSize="Small" TextColor="Black" HorizontalOptions="CenterAndExpand" />
</StackLayout>
<StackLayout Grid.Row="2" Grid.Column="0" HorizontalOptions="FillAndExpand" Orientation="Vertical">
<Label Text="Gender" FontSize="Small" TextColor="#757575" HorizontalOptions="CenterAndExpand"/>
<Label x:Name="genrealsectionforreadonlylblGender" Text="F" FontSize="Small" TextColor="Black" HorizontalOptions="CenterAndExpand" />
</StackLayout>
<StackLayout Grid.Row="2" Grid.Column="1" HorizontalOptions="FillAndExpand" Orientation="Vertical">
<Label x:Name="genrealsectionforreadonlylblDobSelector" Text="Date of birth" FontSize="Small" TextColor="#757575" HorizontalOptions="CenterAndExpand"/>
<Label x:Name="genrealsectionforreadonlylblDob" Text="5/11/1900" FontSize="Small" TextColor="Black" HorizontalOptions="CenterAndExpand" />
</StackLayout>
<StackLayout Grid.Row="2" Grid.Column="2" HorizontalOptions="FillAndExpand" Orientation="Vertical">
<Label Text="Language" FontSize="Small" TextColor="#757575" HorizontalOptions="CenterAndExpand"/>
<Label x:Name="genrealsectionforreadonlylblLang" Text="ENG" FontSize="Small" TextColor="Black" HorizontalOptions="CenterAndExpand" />
</StackLayout>
<StackLayout Grid.Row="3" Grid.Column="0" HorizontalOptions="FillAndExpand" Orientation="Vertical">
<Label Text="Nationality" FontSize="Small" TextColor="#757575" HorizontalOptions="CenterAndExpand"/>
<Label x:Name="lblNationality" Text="LKA" FontSize="Small" TextColor="Black" HorizontalOptions="CenterAndExpand" />
</StackLayout>
<StackLayout Grid.Row="3" Grid.Column="1" HorizontalOptions="FillAndExpand" Orientation="Vertical">
<Label Text="Postal Code" FontSize="Small" TextColor="#757575" HorizontalOptions="CenterAndExpand"/>
<Label x:Name="genrealsectionforreadonlyPcode" Text="DEFAULT" FontSize="Small" TextColor="Black" HorizontalOptions="CenterAndExpand"/>
</StackLayout>
</Grid>
推荐阅读
- ruby-on-rails - ElasticSearch maxClauseCount 设置为 1024
- javascript - 按下按钮时内容未加载
- join - 如何在 Pyspark 中加入两个具有特定列的 RDD?
- mysql - 错误:MySQL 意外关闭。这可能是由于端口被阻塞,缺少依赖项
- rest - 检查 Microsoft 图形令牌过期
- reactjs - React 中的 Lottie 动画导致内存泄漏/浏览器在重新渲染时冻结
- javascript - 无法解析转义的 ejs 传递的变量
- javascript - Create-React-App - 修改 serviceWorker 以轮询新的更新?
- aws-amplify - 如何正确配置 Amplify Analytics?
- mysql - 如何将查询作为参数传递给使用它进行查询的 bash 函数?