我能够使用Request.Browser.IsMobileDevice检测在iOS 11.4上运行的 iPadAir2 设备,它给我 UserAgent 信息说它是 iPad:

当我对在iOS 13.0.1上运行的 iPadAir2 做同样的事情时,它不再给我 iPad 关键字:

我如何检测它的 ipad 并运行 safari 浏览器?
我需要它来检测 Razor .chtml 页面中的 iPad,以便我可以为我的网站显示不同的菜单。
我从这里找到了这个解决方案如何在 iOS 13 上的 Safari 中检测设备名称,而它没有显示正确的用户代理?
让 isIOS = /iPad|iPhone|iPod/.test(navigator.platform) || (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1)
如何在 razor 中使用此变量来更改网站菜单?
当在form1上扫描条形码时,我调用数据库以获取该条形码的项目,并使用预先填充的数据打开form2。
如果我使用文本更改事件,则它的生成次数与一个条形码中的数字相同。
我无法检查条形码的长度,因为每次都可能不同。
扫描条形码时,我应该使用哪个事件只打一个电话?
我尝试了TextChanged,KeyPress,KeyDown事件,但是它们都被多次调用了。
private void txt_Barcode_TextChanged(object sender, EventArgs e)
{
con.Open();
GenerateInvoice gn = new GenerateInvoice();
string query = "SELECT * FROM dbo.Inventory WHERE Barcode = '" + txt_Barcode.Text + "' ";
SqlCommand cmd = new SqlCommand(query, con);
SqlDataReader dr = cmd.ExecuteReader();
while (DR1.Read())
{
gn.txt_Barcode.Text = dr["Barcode"].ToString();
gn.txt_ProductName.Text = dr["ProductName"].ToString();
gn.txt_Price.Text = dr["SellingPrice"].ToString();
gn.txt_QTY.Text = 1.ToString();
gn.txt_Total.Text = dr["SellingPrice"].ToString();
}
con.Close();
}
Run Code Online (Sandbox Code Playgroud)
我愿意使用文本框捕获Form1上的条形码(我将其隐藏在UI中)
我在android上使用react-native-maps。我放置了一个自定义按钮,单击该按钮应转到提供的坐标(我当前的位置)
<MapView
ref={(map) => { this.map = map; }}
provider={PROVIDER_GOOGLE}
style={{ height: '100%', width: '100%' }}
annotations={markers}
showsUserLocation={true}
showsMyLocationButton={true}
initialRegion={this.state.region}
onRegionChangeComplete={this.onRegionChange}
>
Run Code Online (Sandbox Code Playgroud)
我的按钮 -
<TouchableOpacity onPress={this.gotToMyLocation} style={[Style.alignJustifyCenter, {
width: 60, height: 60,
position: "absolute", bottom: 20, right: 20, borderRadius: 30, backgroundColor: "#d2d2d2"
}]}>
<Image
style={{ width: 40, height: 40 }}
source={Images.myLocation}
/>
</TouchableOpacity>
Run Code Online (Sandbox Code Playgroud)
获取到我的位置方法 -
gotToMyLocation(){
console.log('gotToMyLocation is called')
navigator.geolocation.getCurrentPosition(
({ coords }) => {
console.log("curent location: ", coords)
console.log(this.map);
if (this.map) {
console.log("curent location: ", coords)
this.map.animateToRegion({
latitude: coords.latitude, …Run Code Online (Sandbox Code Playgroud) 我试图在 headerRight 按钮单击屏幕上调用函数。我在 useEffect 中将 func 作为参数传递,如下所示。
useEffect(() => {
navigation.setParams({ _confirmClick: confirmNotification })
}, [navigation])
useLayoutEffect(() => {
navigation.setOptions({
headerRight: () => (
<TouchableOpacity
onPress={() => params._confirmClick('New') }
style={[theme.marginRight15]}>
<View style={[styles.sendNotificationButton,
{
backgroundColor: notification ? theme.colors.notificationDeleteButtonColor :
theme.colors.sendbuttonColor,
borderColor: notification ? theme.colors.notificationDeleteButtonColor :
theme.colors.sendbuttonColor,
}]}>
<Ionicons name="ios-send" size={15}
style={theme.padding3}
color={theme.colors.whiteColor} />
</View>
</TouchableOpacity>
),
});
}, [navigation]);
function confirmNotification(status) {
...
}
Run Code Online (Sandbox Code Playgroud)
当我点击按钮时,它说:TypeError:无法读取未定义的属性“_confirmClick”
在我的 reactJs 项目中,我需要在上传之前调整图像大小。
我正在使用react-image-file-resizer库,它有一个简单的例子,但对我不起作用。
我试过这个,但它显示我空白的结果。我究竟做错了什么?
var imageURI = '';
const resizedImg = await Resizer.imageFileResizer(
fileList.fileList[0].originFileObj,
300,
300,
'JPEG',
100,
0,
uri => {
imageURI = uri
console.log(uri ) // this show the correct result I want but outside of this function
},
'blob'
);
console.log(resizedImg)
console.log(imageURI)
// upload new image
...uploading image here..
Run Code Online (Sandbox Code Playgroud)
如果我imgRef.put(uri);在 URI 函数中执行,则图像上传工作。但我需要在该功能之外执行此操作。
如何在 imageURI 变量中获取结果并在以后重用它?
我正在将 antd 表用于 reactjs 应用程序。
我在这里创建了Sandbox供您进行更改。谁能帮我制作带有圆角边框的行,如下图所示?
我曾尝试添加 rowClassName={() => "rowClassName1"}与边框相关的 css,但边框不会显示。
我正在antd为 Next.js 项目使用npm 包。我正在努力更改Form.Item组件的标签文本颜色。
我在下面尝试,但它没有改变标签颜色。
<Form form={form} labelCol={{ span: 6 }} wrapperCol={{ span: 20 }} labelAlign="left" initialValues={{ size: "middle" }}
size={"middle"} onFinish={onFinish} style={{ color: "#fff" }}>
<Form.Item label="City" name="city" style={{ color: "#fff" }}>
<Input />
</Form.Item>
</Form>
Run Code Online (Sandbox Code Playgroud) 我有一个非常简单的 ADF 管道,用于将数据从本地 mongoDB(自托管集成环境)复制到 Azure SQL 数据库。
我的管道能够从 mongoDB 复制数据并插入到 SQL 数据库中。目前,如果我运行管道,它会在多次运行时插入重复数据。
我已经将 _id 列作为 SQL 数据库中的唯一列,现在运行管道抛出和错误,因为 SQL 约束不会让它插入记录。
如何在插入 SQL 数据库之前检查重复的 _id?
我应该使用预复制脚本/存储过程吗?一些指导/说明将有助于在何处添加额外步骤。谢谢
azure azure-data-factory azure-sql-database azure-data-factory-2
我生成的对象是这样的:
[{
"device": {
"_id": "5d25f9d2dc4aea7838b0aaa1",
"serialNumber": "100000100215",
"patientRiskStatus": "high",
"createdAt": "2017-04-16T01:22:00.000Z",
"updatedAt": "2020-01-01T05:29:19.632Z"
},
"firstName": "userName"
}]
Run Code Online (Sandbox Code Playgroud)
我想将此对象结构转换为:
[{
"_id": "5d25f9d2dc4aea7838b0aaa1",
"serialNumber": "100000100215",
"firstName": "userName",
"patientRiskStatus": "high",
"createdAt": "2017-04-16T01:22:00.000Z",
"updatedAt": "2020-01-01T05:29:19.632Z",
}]
Run Code Online (Sandbox Code Playgroud)
这是我的代码 -
var filteredDevices = []
var result = []
if (user.role === 'Nurse') {
devices.forEach((device) => {
filteredDevices.push({
device: device,
firstName: "userName"
})
result = filteredDevices.map(({ device, ...rest }) => ({
...rest,
...device
}))
})
}
Run Code Online (Sandbox Code Playgroud)
我尝试了下面建议的解决方案,它在代码片段示例中看起来不错,但我的 node.js 只是行为不同,我不知道为什么。
我在尝试解决方案时得到的结果如下。不知道为什么它给了我这么长的结果。
[
{
"firstName": "Rikin",
"__parentArray": [ …Run Code Online (Sandbox Code Playgroud) react-native ×3
reactjs ×3
antd ×2
c# ×2
azure ×1
barcode ×1
ipad ×1
iphone ×1
javascript ×1
next.js ×1
node.js ×1
razor ×1
react-hooks ×1
winforms ×1