我刚开始学习如何使用Blazor模板制作网站.但我不知道如何将数据从一个页面传递到另一个页面.它与.NET CORE MVC Web应用程序有点不同,我找不到这样的例子.
<p>Solve This problem: @rnd1 * @rnd2 = ?</p>
<input type="text" name="result" bind="@result" />
<input type="button" onclick="@calculate" value="Submit" />
Run Code Online (Sandbox Code Playgroud)
我想将文本框中的值发送到另一个页面.我怎样才能做到这一点?
我知道如何获得当地的日期和时间,但我想要做的是从不同的地方获取日期和时间.例如,我想知道纽约的时间和日期.我该如何解决这个简单的问题?
这是我的本地日期和时间代码:
let date = NSDate()
let calendar = Calendar.current
let components = calendar.dateComponents([.hour, .minute, .month, .year, .day, .second, .weekOfMonth], from: date as Date)
let currentDate = calendar.date(from: components)
Run Code Online (Sandbox Code Playgroud)
我在这里搜索了一下,但我找不到我想要的东西,而且我还在寻找日期图书馆.如果您知道要重定向我的任何来源或样本,我真的很感激.
我正在尝试获取使用Blazor框架进行检查的复选框的值,但到目前为止我找不到任何方法。当我将绑定放在复选框中时,始终会选中它。我不知道如何获得检查的值。
这是我的代码:
<input type="checkbox" id="addition" name="math" value="add" bind="@name" />
<label for="addition">Addition</label>
Run Code Online (Sandbox Code Playgroud) 我正在将一些 firebase SDK 实施到我的 pod 中,但我在对它们进行版本控制时遇到问题。我想设置 Firebase 6.33。我确实检查了这个版本的 pod 规格并根据它更新了我的 pod。
pod 'Firebase', '~> 6.33.0'
pod 'FirebaseCore', '~> 6.10.3'
pod 'FirebasePerformance', '~> 3.3.0'
pod 'FirebaseRemoteConfig', '~> 4.9.0'
pod 'FirebaseAnalytics', '~> 6.8.3'
pod 'FirebaseCrashlytics', '~> 4.6.1'
Run Code Online (Sandbox Code Playgroud)
当我使用上面的代码时,它在 jenkins 上给了我这个错误:
您的规范来源均不包含满足以下依赖项的规范:Firebase (~> 6.33.0)、Firebase (= 6.33.0, ~> 6.33.0)。
我pod deintegrate
首先pod install
做了一个干净的安装。它不会在我的 MacBook 上给出错误,而是在 jenkins 上给出错误。
podspec.json:https : //github.com/CocoaPods/Specs/blob/master/Specs/0/3/5/Firebase/6.33.0/Firebase.podspec.json
我正在使用Tab Bar Controller,上面有2个视图控制器。在此之前,我还有另一个viewController来访问选项卡栏。当我看到标签栏时,后退按钮总是消失。我想隐藏后退按钮,并使用另一个按钮作为左按钮,但是我无法隐藏后退按钮。
这是viewController中Tab栏之前的代码:
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "mainvc"{
if pinLabel.text == pinPassword && pinLabel.text != ""{
let tabBarController = segue.destination as! UITabBarController
let destinationViewController = tabBarController.viewControllers?[0] as! ViewController
destinationViewController.login.email = login.email
destinationViewController.login.firstname = login.firstname
destinationViewController.login.lastname = login.lastname
destinationViewController.login.imageURL = login.imageURL
destinationViewController.login.id = login.id
}else{
}
}
}
Run Code Online (Sandbox Code Playgroud)
这是我要隐藏后退按钮并将另一个按钮放入视图控制器之一的代码,这是我在访问选项卡栏控制器时看到的视图控制器:
let leftOpenSideBarMenu: UIBarButtonItem = UIBarButtonItem(image: myimage, style: .plain, target: self, action: #selector(ViewController.openSideBarMenu))
self.navigationItem.setHidesBackButton(true, animated: false)
self.navigationItem.setLeftBarButtonItems([leftOpenSideBarMenu], animated: true)
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用Blazor的CRUD函数,并在阅读一些文章之后才能做到这一点。在本文中,有一部分我应该将我的连接放在上下文文件中,但是没有说明如何设置连接字符串。
我将此代码行放在launchSettings.json中:
{
"ConnectionStrings": {
"UserDatabase": "Server=DESKTOP-2K2A6GN;Database=Assignment4;Trusted_Connection=True;"
},
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:56244/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Assignment4.Server": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:56248/"
}
}
}
Run Code Online (Sandbox Code Playgroud)
我试图将连接字符串添加到上下文文件中,但是没有用。
public class UserContext : DbContext
{
public virtual DbSet<User> tblUser { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (!optionsBuilder.IsConfigured)
{
optionsBuilder.UseSqlServer(@"UserDatabase");
}
} …
Run Code Online (Sandbox Code Playgroud) 我要尝试使用KYDrawerController
或SWRevealViewController
侧栏菜单.但是有一个问题,每个人都给出了一个相同viewcontroller的例子.当我按下tableView上的单元格并保留侧栏菜单时,我想更改viewcontroller.这是我第一次使用侧栏菜单.我猜这就是为什么我没有得到主要想法,我不能这样做.如果你给我一个想法或样品,我会很感激.
当我UIButton
一起点击这两个时,它同时打开.我的目的是当我点击单曲时UIButton
,其他人将无法点击.我认为这是关于多点触控功能.我只是想使用单点触控.
我的代码:
self.view.multipleTouchEnabled = false
self.view.exclusiveTouch = true
Run Code Online (Sandbox Code Playgroud)
我尝试了这段代码viewDidLoad
,但没有用.
swift ×4
ios ×3
asp.net-core ×2
blazor ×2
c# ×2
html ×2
.net-core ×1
back-button ×1
cell ×1
cocoapods ×1
firebase ×1
multi-touch ×1
nscalendar ×1
nsdate ×1
tableview ×1
uibutton ×1
xcode ×1