我正在尝试在create-react-app
typescript
项目中使用@ant-design/pro-layout
。
我无法使用@ant-design/pro-layout
的样式。组件可以很好地加载,但是LESS不能。
除了遵循教程use with create-react-app
之外,还有其他事情要做吗?
答案 0 :(得分:0)
我遇到了同样的问题。 根据我的理解,我是React的新手,尽管create-react-app 不会对sass和scss进行编译,但它编译的次数不会减少。
因此,您有antd documentation中所述的2(+1)个选项。
<script>
$(document).ready(function () {
$('#postAdd').click(function(e){
e.preventDefault();
var form = $('#addPost');
formData.append('file', $('input[type=file]')[0].files[0]);
$.ajax({
type: "POST",
url: "{{ route('posts.store') }}",
data: formData,
success: function (response) {
console.log(response)
},
error: function (error) {
console.log(error)
}
})
})
})
</script>
的回答是here的回答)。注入后,您可以选择here并修改webpack.config.js。在webpack.config.js中,您必须添加:
public static class ArrayExtension
{
public static T[] FindMissing1<T>(T[] range, T[] values)
{
List<T> result = Enumerable.Except<T>(range, values).ToList<T>();
return result.ToArray<T>();
}
public static T[] FindMissing2<T>(T[] range, T[] values)
{
List<T> result = new List<T>();
Dictionary<T, T> hash = new Dictionary<T, T>(values.Length);
for (int i = 0; i < values.Length; i++)
hash.Add(values[i], values[i]);
for (int i = 0; i < range.Length; i++)
{
if (!hash.ContainsKey(range[i]))
result.Add(range[i]);
}
return result.ToArray<T>();
}
}
public class ArrayManipulationTest : MonoBehaviour
{
void Start()
{
int rangeLength = 1000000;
int[] range = Enumerable.Range(0, rangeLength).ToArray();
int[] values = new int[rangeLength / 5];
int[] missing;
float start;
float duration;
for (int i = 0; i < rangeLength / 5; i ++)
values[i] = i * 5;
start = Time.realtimeSinceStartup;
missing = ArrayExtension.FindMissing1<int>(range, values);
duration = Time.realtimeSinceStartup - start;
Debug.Log($"FindMissing1 Total time: {duration:0.0000}");
start = Time.realtimeSinceStartup;
missing = ArrayExtension.FindMissing2<int>(range, values);
duration = Time.realtimeSinceStartup - start;
Debug.Log($"FindMissing2 Total time: {duration:0.0000}");
}
}
不要忘记 VideoView videoView;
ProgressBar progressbar;
private Button Play;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_levelonefree);
videoView=findViewById(R.id.videoLevelonefree);
progressbar =(ProgressBar) findViewById(R.id.pro);
Play=(Button)findViewById(R.id.playvideo);
final MediaController mediaController=new MediaController(this);
Play.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
videoView.setMediaController(mediaController);
mediaController.setAnchorView(videoView);
Uri uri=".............");
videoView.setVideoURI(uri);
videoView.start();
}
});
}
}
。
我个人弹出并手动配置了Webpack。