我正在尝试构建一个文件上传组件。早些时候我确实使用过<input type="file">,但我有很少的空间来容纳输入类型,并且在小空间内,我必须显示“选择文件”和总文件路径。当我减小宽度时,组件显示不太美观。
这是我之前的代码:
<label id="licensefile">
LicenseFile
<input
type="file"
name="personalLicense"
className={styles.personallicense}
/>
</label>
Run Code Online (Sandbox Code Playgroud)
我的CSS:
.personallicense{
position: absolute;
top: 78px;
left:250px;
width:50px;
padding: 0;
margin:0;
}
input[name="personalLicense"] {
width: 30px;
}
Run Code Online (Sandbox Code Playgroud)
我一直在寻找使用 Mui 的替代品
我想建立这样的东西:
import FileUploadOutlined from "@mui/icons-material/FileUploadOutlined";
import TextField from "@mui/material/TextField";
<label >
License
<TextField
variant="standard"
type="text"
InputProps={{
endAdornment: (
<FileUploadOutlined
onClick={() => {
handleUpload();
}}
>
</FileUploadOutlined>
),
}}
/>
</label>
Run Code Online (Sandbox Code Playgroud)
如何从类似于输入类型“文件”的 Mui 中调用文件上传
容纳该组件的总空间几乎为 50 到 60 px。我无法调整更多,因为它是现有的组件。
需要以下方面的帮助。
在javascript中,需要传递一个输入
例如:
str="<a href=www.google.com>Google</a>"; // this is for example actual input vary
// str is passed as parameter for javascript function
Run Code Online (Sandbox Code Playgroud)
输出应检索为“Google”。
我在java中有正则表达式,它在其中运行良好。
String regex = "< a [ ^ > ] * > ( . * ? ) < / a > ";
Pattern p = Pattern.compile(regex, Pattern.DOTALL | Pattern.CASE_INSENSITIVE);
Run Code Online (Sandbox Code Playgroud)
但在 javascript 中它不起作用。
我怎样才能在 JavaScript 中做到这一点。任何人都可以为我提供有关 javascript 实现的帮助吗?
我想在 Vaadin 中创建一个自定义组件。但我没有从组件类扩展它,而是尝试如下
公共类 MyMapComponent 扩展 LMap 实现 Component { }
我收到错误为
getId()' in 'com.vaadin.ui.AbstractComponent' clashes with 'getId()' in 'com.vaadin.flow.component.Component'; attempting to use incompatible return type.
Run Code Online (Sandbox Code Playgroud)
如何解决这个错误?实现这一目标的最佳方法是什么?
我的方向正确吗?我想将 LMap 添加为 Vaadin 14 中的组件。由于 v-leaflet 不支持 Vaadin 8 以上版本,因此我正在尝试 MPR,我试图将 LMap 添加为 vaadin 流中的组件。