null-layout-manager 相关问题


将 props 传递给 nextjs 中的页面组件

我正在使用 nextjs 的 withlayout 函数为某些页面添加侧边栏。 导出类型 PageWithLayout = NextPage & { withLayout?:(页面:ReactElement)=> 我正在使用 nextjs 的 withlayout 函数为某些页面添加侧边栏。 export type PageWithLayout<P = {}, IP = P> = NextPage<P, IP> & { withLayout?: (page: ReactElement) => ReactNode; }; 这是我的使用方法: export const Interactions: PageWithLayout = () => { const [ getInteractions, { data: interactionData, fetchMore, variables, loading: isInteractionsLoading, error: isInteractionsError, }, ] = useGetInteractionsLazyQuery({ notifyOnNetworkStatusChange: true, fetchPolicy: "network-only", ssr: false, }); return ( <> <Box height={"100vh"}> </Box> </> ); }; Interactions.withLayout = (page: ReactElement) => { // how do I pass isInteractionsLoading as a prop to this component return <Layout>{page}</Layout>; }; export default Interactions; 我想要实现的是将 isInteractionsLoaded 和 isInteractionsError 作为属性传递给我的布局组件,以便我可以渲染这些状态。有没有一种方法可以实现此目的,而无需将布局组件移动到页面组件内? 创建一个包装组件的 React Context 提供程序可能是您使用的解决方案,如果您不想使用任何其他包或不想使用 redux 等更强大的工具,则可以使用。 但是在这里使用有点尴尬,具体取决于包含交互的组件树是什么样子。否则可以根据您的需要使用 _app 入口点。 示例上下文和用法 import React from 'react'; export const InteractionContext = React.createContext({ isInteractionsLoading: false, isInteractionsError: null, }); // parent component or _app if necessary const ProviderComponent = () => { return ( <InteractionContext.Provider value={{ isInteractionsLoading, isInteractionsError }}> <Interactions /> </InteractionContext.Provider> ); }; const Layout = ({ children }) => { const { isInteractionsLoading, isInteractionsError } = useContext(InteractionContext); // Now you can use isInteractionsLoading and isInteractionsError here // ... return <div>{children}</div>; };


检查变量是否为空

if ($user_id == NULL || $user_name == NULL || $user_logged == NULL) { $user_id = '-1'; $用户名 = NULL; $user_logged = NULL; } 如果($user_admin == NULL){ $user_admin = NULL; } 是...


通过 github 操作创建 EC2 AMI 时出现错误:exec: "session-manager-plugin": $PATH 中找不到可执行文件

==> learn-packer.amazon-ebs.ubuntu:exec:“session-manager-plugin”:在 $PATH 中找不到可执行文件 learn-packer.amazon-ebs.ubuntu:启动 portForwarding 会话“Amy-


使用 YubiKey Manager 和 .crt 证书(不使用 .PFX)签署 MSI 文件时出现问题

我一直在尝试使用 YubiKey Manager 和 .crt 证书(由于最近的 CAB 和 Sectigo 规则而不是 PFX)来签署我的 MSI 文件,但找不到让它工作的好方法。 我已经关注了这些


SharePoint 修补问题

我们在装有 SharePoint Server 2019 的 Microsoft Identity Manager (MIM) Web 服务器上应用了 12 月份的 SharePoint 补丁(KB5002531 和 KB5002532)。修补后,我们看到以下错误“The con...”


SSAS/Power BI 行级安全性

我一直在使用 radacad 创建的一些非常有用的文章(例如 https://radacad.com/dynamic-row-level-security-with-manager-level-access-in-power-bi),使我能够添加一些行级安全...


GA4 配置发送浏览器标题而不是 CustomVirtualPageTitle

我已按照本指南中提到的步骤进行操作:https://www.analyticsmania.com/post/single-page-web-app-with-google-tag-manager/ 每当用户导航时 dataLayer.push 代码页面/st之间...


TextInput 在小屏幕手机上显示太窄

在以下 xml 中,“message_entry”在小屏幕 (240 x 320) 上显示太窄,但在较大屏幕 (480 x 640) 上显示良好。 在以下 xml 中,“message_entry”在小屏幕 (240 x 320) 上显示太窄,但在较大屏幕 (480 x 640) 上显示良好。 <androidx.cardview.widget.CardView android:id="@+id/reply_bar_card" android:layout_width="match_parent" android:layout_height="wrap_content" app:cardBackgroundColor="@color/replyBarCard" app:cardCornerRadius="24dp" app:cardElevation="5dp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:paddingBottom="24dp"> <ProgressBar android:id="@+id/send_progress" style="@style/Widget.AppCompat.ProgressBar.Horizontal" android:layout_width="match_parent" android:layout_height="3dp" android:indeterminate="true" android:visibility="invisible" /> <HorizontalScrollView android:id="@+id/attached_image_scroller" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginStart="@dimen/message_list_padding" android:layout_marginEnd="@dimen/message_list_padding" android:paddingTop="8dp" android:paddingBottom="8dp" android:scrollbars="none" android:visibility="gone"> <LinearLayout android:id="@+id/attached_image_holder" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="12dp" android:layout_marginEnd="12dp" android:orientation="horizontal" /> </HorizontalScrollView> <LinearLayout android:id="@+id/smart_reply_container" android:layout_width="match_parent" android:layout_height="56dp" android:layout_marginStart="@dimen/message_list_padding" android:layout_marginEnd="@dimen/message_list_padding" android:gravity="end" android:orientation="horizontal" android:visibility="gone"> <ImageButton android:id="@+id/close_smart_replies" android:layout_width="32dp" android:layout_height="48dp" android:layout_gravity="center_vertical" android:layout_marginStart="8dp" android:background="?selectableItemBackgroundBorderless" android:clickable="true" android:contentDescription="@string/use_smart_replies" android:src="@drawable/ic_cancel" android:tint="@color/secondaryText" /> <LinearLayout android:id="@+id/smart_reply_suggestions_container" android:layout_width="0dp" android:layout_height="match_parent" android:layout_marginEnd="12dp" android:layout_weight="1" android:gravity="end" android:orientation="horizontal" /> </LinearLayout> <LinearLayout android:id="@+id/send_bar" android:layout_width="match_parent" android:layout_height="50dp" android:layout_marginStart="@dimen/message_list_padding" android:layout_marginEnd="@dimen/message_list_padding" android:alpha="0" android:clipToPadding="false" android:gravity="center_vertical|start" android:orientation="horizontal" android:padding="8dp" android:translationY="-32dp"> <ImageButton android:id="@+id/select_sim" android:layout_width="32dp" android:layout_height="48dp" android:background="?selectableItemBackgroundBorderless" android:clickable="true" android:contentDescription="@string/select_sim" android:src="@drawable/ic_sim" android:tint="@color/secondaryText" android:visibility="gone" /> <ImageButton android:id="@+id/view_scheduled_messages" android:layout_width="32dp" android:layout_height="match_parent" android:background="?selectableItemBackgroundBorderless" android:clickable="true" android:contentDescription="@string/view_scheduled_messages" android:src="@drawable/ic_schedule_small" android:tint="@color/secondaryText" android:visibility="gone" /> <FrameLayout android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_marginEnd="8dp"> <ImageButton android:id="@+id/attach" android:layout_width="32dp" android:layout_height="48dp" android:layout_gravity="center_vertical|start" android:background="?selectableItemBackgroundBorderless" android:clickable="true" android:contentDescription="@string/attach" android:src="@drawable/ic_attach" android:tint="@color/secondaryText" /> <TextView android:id="@+id/text_counter" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="bottom|center_horizontal" android:layout_marginBottom="2dp" android:gravity="center_horizontal" android:textColor="@color/secondaryText" android:textSize="12sp" /> </FrameLayout> <com.google.android.material.textfield.TextInputEditText android:id="@+id/message_entry" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:background="@null" android:backgroundTint="@color/drawerBackground" android:hint="@string/type_message_to" android:imeOptions="actionSend|flagNoExtractUi" android:inputType="textCapSentences|textAutoCorrect|textMultiLine" android:maxLines="@integer/message_list_fragment_line_entry_count" android:minHeight="40dp" android:padding="8dp" android:paddingStart="8dp" android:paddingEnd="18dp" android:scrollHorizontally="false" android:textSize="16sp" /> <com.google.android.material.floatingactionbutton.FloatingActionButton android:id="@+id/send" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="8dp" android:layout_marginEnd="8dp" android:contentDescription="@string/send_message" android:src="@drawable/ic_send" app:elevation="0dp" app:fabSize="mini" app:rippleColor="@android:color/white" /> </LinearLayout> <ViewStub android:id="@+id/attach_stub" android:layout_width="match_parent" android:layout_height="@dimen/attach_menu_height" android:layout="@layout/view_attach_menu" /> </LinearLayout> </androidx.cardview.widget.CardView> 小屏幕:(添加红框用于说明) 大屏幕:(添加红框作为说明) 预期的行为就像大屏幕,其中“message_entry”尽可能宽。为什么“message_entry”在小屏幕上那么窄?我该如何解决它? 原来是因为dimens.xml文件夹下有多个res文件造成的。这用于支持多种屏幕尺寸,在较小屏幕的 dimens.xml 中,有 <dimen name="message_list_padding">96dp</dimen>。一旦更改为0dp,布局就如预期的那样。 有关多个 dimens.xml 文件的更多信息,请参阅此答案中的#2。


Flutter 模拟器 > Android studio SDK Manager > 命令行工具安装问题

我刚刚开始学习Flutter。 在我的 Mac 上安装 Android studio 时出现错误 😭 (实际上,安装已完成,应用程序看起来不错。但 flutter doctor 返回问题) 我的环境...


本地运行测试时如何禁用 Spring Cloud Google Secret Manager 4.x+?

我们使用的是 spring boot 3.2,我们正在尝试将 spring-cloud-gcp-starter-secretmanager 从版本 3.2.1 升级到 4.9.0。当我们这样做时,我们的集成测试会失败,并显示: java.lang.


无需公钥、私钥和公共 Ips 即可通过 SSH 连接到 Aws Ec2 实例

在我的公司,一位同事创建了没有公共 IP 地址的 Ec2 实例。我没有公钥和私钥。我可以与 SSM Manager 或 EC2 Instance Connect Endpoint 建立连接,但我...


在 SQL Developer 上运行创建表学生时出错:CREATE TABLE Students

创建表学生( 年号(4) NOT NULL, 学期 VARCHAR2(1) NOT NULL CONSTRAINT Stu_sem_ck CHECK (学期 IN ('1', '2', '3')), 部门 VARCHAR2(3) NOT NULL, 课程编号...


为什么NLog不每天归档

NLog 存档每天都不起作用。但它每分钟都有效 NLog版本5.0.7 这是我的配置 NLog 每天存档不起作用。但它每分钟都有效 NLog版本5.0.7 这是我的配置 <target name="Httpfile" layout="${longdate} ${uppercase:${level}} correlationId-${activityid} - ${message} ${exception:format=tostring}" xsi:type="File" fileName="${logFullName}-http-api-${shortdate}.log" archiveFileName="${logFullNameArchive}-archive-Http-api-${shortdate}-{#####}.zip" archiveEvery="Day" concurrentWrites="true" keepFileOpen="false" archiveNumbering="DateAndSequence" maxArchiveFiles="30" maxArchiveDays="7" enableArchiveFileCompression="true" /> 使用 archiveEvery="Minute" 效果很好 不支持在NLog FileTarget中混合静态和动态归档逻辑。 使用静态归档逻辑时,不应在 ${shortdate} 和 fileName="..." 中使用 archiveFileName="..."。 像enableArchiveFileCompression="true"这样的一些功能仅受静态归档逻辑支持: <target name="Httpfile" layout="${longdate} ${uppercase:${level}} correlationId-${activityid} - ${message} ${exception:format=tostring}" xsi:type="File" fileName="${logFullName}-http-api.log" archiveFileName="${logFullNameArchive}-archive-Http-api-{#####}.zip" archiveNumbering="DateAndSequence" archiveDateFormat="yyyyMMdd" archiveEvery="Day" concurrentWrites="true" keepFileOpen="false" maxArchiveFiles="30" maxArchiveDays="7" enableArchiveFileCompression="true" /> 另请参阅:https://github.com/NLog/NLog/wiki/FileTarget-Archive-Examples


可能会抛出“NullPointerException”; “getBody()”可以返回 null

ResponseEntity commonResponseDto = testClient.getCategoryById(sampleEntity.getCategoryId()); if(Objects.nonNull(commonResponseDto) && Objects.nonNull(


在 SQL Server 中比较 NULL 与 NULL

我有一些代码,其中 WHERE 子句中使用的变量可以为空。因此,我必须使用 IF ELSE 查询数据来检查 NULL。有没有办法在一个查询中写入? 声明@


SQL - 删除除一组最大值之外的所有记录

请帮忙SQL查询。我有一张桌子: 创建表 tblTest ( Id INT 主键不为空, 重量 INT NULL, 批处理 INT NULL, t_stamp 日期时间 null ); 让我们假设它充满了值: ...


MySQL:存储罕见的长字符串

有一个MySQL表: 创建表`变量` ( `名称` VARCHAR(50) NOT NULL, `值` VARCHAR(250) NOT NULL, 主键(`名称`) ) 引擎=InnoDB 字符集=utf8mb4; 只有一...


SonarQube 警告:可能会抛出“NullPointerException”; “getBody()”可以返回 null

ResponseEntity commonResponseDto = testClient.getCategoryById(sampleEntity.getCategoryId()); if(Objects.nonNull(commonResponseDto) && Objects.nonNull(


从 Silverstripe BulkManager 添加和删除操作

向 modelAdmin 添加批量管理器,如下所示: 使用Colymba\BulkManager; FAQAdmin 类扩展了 ModelAdmin { 公共函数 getEditForm($id = null, $fields = null) { $form = 父级::getEd...


在 .NET 8 上的主构造函数 EF Core 中调用时,DbContext 为 Null

我使用的是.NET 8,在主构造函数中调用时,我的 DbContext 为 null,但在普通构造函数中调用时,我的 DbContext 为 null。 这是我的 DbContext: 公共类 DataContext(DbContextOptions 优化...


未定义的变量:Laravel 8 上的 __env

这是我的代码: @foreach($comments->where("id_answered_comment", null) as $comment) @php


“struct Obj* obj”和“Obj* obj”之间的区别[重复]

结构元素{ 元素() {} int 数据 = NULL; 结构元素*右,*左; }; 或者 结构体元素{ 元素() {} int 数据 = NULL; 元素*右,*左; }; 我正在与


如何高效且线程安全地实现单例? [重复]

单例类的通常模式是这样的 静态 Foo &getInst() { 静态 Foo *inst = NULL; if(inst == NULL) inst = new Foo(...); 返回*安装; } 然而,这是我的


如何使用闭包表遍历树结构以便在 Eloquent 模型中创建 json?

在我的应用程序中,我有下表: 创建表文件( id bigint IDENTITY(1,1) NOT NULL, 名称 nvarchar(255) 整理 SQL_Latin1_General_CP1_CI_AS NOT NULL, 文件夹 bigint NUL...


graphql-spqr 在响应 json 中发送空值

我们已将 Spring Boot 应用程序配置为不以 json 形式发送回 null 值,但我们仍然会返回 null 值。使用 Jackson ObjectMapper 不发送空值的设置位于


点击邮递员的请求时在 POSTMapping 中获取 null

我是 spring 新手,在创建一个 POSTMapping 到 addUser 时,我在邮递员上收到 406 错误,在控制器类中收到 null 。 包 com.codedecode.userinfo.DTO; 导入龙目岛。*; @数据 @


尝试在 Laravel 中读取 null 上的属性“id”

当我要从前端以管理员身份更新 SEO 时,它向我显示错误“尝试读取 null 上的属性“id””,我已附加错误 ss。请尽快帮助我。 这……


删除除一组最大值之外的所有记录

我有这张桌子: 创建表 tblTest ( Id INT 主键不为空, 重量 INT NULL, 批处理 INT NULL, t_stamp 日期时间 空 ); 让我们假设它充满了值: 插入我...


&& 破坏了 WordPress 中的页面

我已将其添加到我的 WordPress 页面 if (script.readyState && script.onload!==null){ script.onreadystatechange=函数(){ if (this.readyState == '完成') mce_preload_check(...


选择 100 张图像时,IFormFileCollection 为 NULL

为什么在 C# 和 ASP.NET Core MVC 中回发到控制器操作时 IFormFileCollection 为 NULL? 如果我选择 10 张图像,它会起作用,如果我选择 100 张图像,它会失败 - 为什么?


避免由于变量为NULL而导致IF ELSE

我有一些代码,其中 WHERE 子句中使用的变量可以为空。因此,我必须使用 IF ELSE 查询数据来检查 NULL。有没有办法在一个查询中写入? 声明@


NotNullIfNotNull属性使用差异

我有一个简单的扩展方法,可以将第一个字母大写,或者如果输入为 null 或空则返回 null 公共静态字符串?大写([NotNullIfNotNull(nameof(s))] 这个字符串? s) { 如果(s.


Razor 生成单行文本

我想编写 Razor 视图助手来生成单行内容: @helper 格式(obj) { @obj.标题 @obj.FormatInnerData() (obj.User != null) { @obj.U...


.Net core Web API 将 json/model 值设置为 NULL

我有一个 .Net core Web API,它接受以下 JSON:(RequestModel) { “isSpecimen”:正确, “形式”: { “网络”:{ “abc1...


Spark SQL 不支持 JSONPATH 通配符的任何解决方法

spark.sql("""select get_json_object('{"k":{"value":"abc"}}', '$.*.value') as j""").show() 这会导致 null,而它应该返回 'a...


反序列化 JSON 返回 null C#

我有以下 JSON,我正在尝试反序列化。 { “输出参数”:[ { “价值”:{ “大批”:{ “元素”:[ { “字符串”:{...


C# 和 ASP.NET Core MVC:选择 100 个图像时 IFormFileCollection 为 NULL

为什么在 C# 和 ASP.NET Core MVC 中回发到控制器操作时 IFormFileCollection 为 NULL? 如果我选择 10 张图像,它会起作用,如果我选择 100 张图像,它会失败 - 为什么?文件上传有限制吗...


Typescript 中的 useState 和 useContext

假设我有一个基本设置来检查用户是否登录: 从“反应”导入{createContext}; const UserContext = createContext(null) 出口...


安装vite时未捕获类型错误:对象原型只能是对象或为null:未定义

我已经更改了react-script并安装了vite,但我有一个问题,它显示白页 继承_browser.js:5未捕获类型错误:对象原型只能是对象或 null:未定义 在功能...


在使用 TypeScript 进行 React 时,输入字段在“值”处给出错误

从“react”导入{SetStateAction,useState} const 登录表单 =() =>{ const [名称,setName] = useState(); const [全名,setFullname] = useState import { SetStateAction, useState } from "react" const Loginform =() =>{ const [name, setName] = useState<String | null>(); const [fullname, setFullname] = useState<String | null>(); const inputEvent =(event: { target: { value: SetStateAction< String |null | undefined >; }; })=>{ setName(event.target.value) } const Submit = ()=>{ setFullname(name) } return <> <h1>Enter Your Name </h1> <input type="text" placeholder="Enter your name" onChange={inputEvent} value={name}/> <button onClick={Submit}>Submit</button> <h1>Hi {fullname==null? "Guest" :fullname}</h1> </> } export default Loginform <input type="text" placeholder="Enter your name" onChange={inputEvent} value={name}/> 上一行中的“value”属性显示错误 这是错误详细信息: (property) React.InputHTMLAttributes<HTMLInputElement>.value?: string | number | readonly string[] | undefined Type 'String | null | undefined' is not assignable to type 'string | number | readonly string[] | undefined'. Type 'null' is not assignable to type 'string | number | readonly string[] | undefined'.ts(2322) index.d.ts(2398, 9): The expected type comes from property 'value' which is declared here on type 'DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>' 也尝试写 return as any。或者尝试添加 string[],但出现错误。 进行以下调整: 将 String 替换为 string,因为原始 Typescript 类型是小写的 (number, string, boolean, etc) TypeScript 报告此错误,因为属性值不接受 null 作为值,而是接受 undefined。将代码更新为: const [name, setName] = useState<string>() 这会使用 string 作为默认类型来初始化状态。 初始状态隐式地被视为 undefined,因为如果未显式提供,TypeScript 会将类型的默认值设置为 undefined。 为了简单起见,您不需要解构事件。使用内联函数,如下例所示: <input type="text" placeholder="Enter your name" onChange={(e) => setName(e.target.value)} value={name}/> 我使用你的代码创建了一个 CodeSanbox,它似乎只需要很少的修改就可以正常工作。 您可以在这里找到沙盒 这是我想出的代码 import { SetStateAction, useState } from "react"; const Loginform = () => { const [name, setName] = useState<string | null>(); const [fullname, setFullname] = useState<string | null>(); const inputEvent = (event: { target: { value: SetStateAction<string | null | undefined> }; }) => { setName(event.target.value); }; const Submit = () => { setFullname(name); }; return ( <div> <h1>Enter Your Name </h1> <input type="text" placeholder="Enter your name" onChange={inputEvent} value={name} /> <button onClick={Submit}>Submit</button> <h1>Hi {fullname == null ? "Guest" : fullname}</h1> </div> ); }; export default Loginform;


如何将yield return与microsoft graph api v5 PageIterator一起使用

目前我正在使用 AsyncEnumerable 从 Graph API 获取组成员 公共异步 IAsyncEnumerable LoadGroupMembers(string GroupId) { if (graphClient == null) th...


如何让EF.Functions.Like不区分大小写?

我使用的是 EF Core 3.1 + MySQL,使用以下方法进行查询: IQueryable 客户 = 来自 u in _context.Users 其中 (u.Customer != null && u.IsActive) 选择...


角度同步融合网格过滤

如何在 Syncfusion Grid 中过滤时禁用自动完成功能 我试过这个: 动作开始(参数){ if (args.requestType === '过滤' && args.currentFilterObject.value == null) { ...


flask_cors 和 pythonanywhere

我想托管一个python脚本(作为服务器端),我托管在pythonanywhere中。 我发现错误:从源“null”访问“https://sifo13.pythonanywhere.com/”处的 XMLHttpRequest 已被...阻止


XSLT 条件问题

当 QUALF 为“012”时,我需要传递 BELNR 值。如果 //E1EDK02/[QUALF=012]/BELNR 为 NULL,则复制 //E1EDK02/[QUALF=002]/BELNR 使用以下代码但出现错误 - The context i...


org.hibernate.mapping.Table.getColumn 返回 null

我正在尝试进行junit测试和测试存储库。为此,我需要使用 h2 数据库创建测试数据库,测试类如下: PokemonRepositoryTest.java: @DataJpaTest @


MySQL 替换为 null

我正在使用替换来用另一个表中的信息更新一个表。 第一个表称为 srv_update,它包括: srv_id、、srv_list_price、srv_list_price ‘120’,‘第三个快乐......


为什么 GetDirectoryName 对 C:\ 返回 null?

我刚刚遇到了一个看起来很奇怪的设计选择: System.IO.Path.GetDirectoryName(@"C: 旧的 ile.ext") 返回“C:较旧” 但 System.IO.Path.GetDirectoryName(@"C:\") 返回空值。 我


Kotlin 是否有可空值的映射函数

我想映射一个可为空的值,如果存在则在该值内应用一个函数,如果不存在则返回null。


如何在 JavaScript 中同步等待获取成功?

我正在尝试执行同步循环,直到成功获取 URL。 这是我尝试过的: 让 res = null fetch("https://jsonplaceholder.typicode.com/users/1").then((res...


© www.soinside.com 2019 - 2024. All rights reserved.