我有两个组件(列表和详细信息):
List.js:
export default class List extends React.Component {
render() {
const {navigate} = this.props.navigation;
return (
<View style={styles.container}>
<Text style={styles.headerText}>List of Contents</Text>
<Button onPress={()=> navigate('Detail')} title="Go to details"/>
</View>
)
}
}
Run Code Online (Sandbox Code Playgroud)
Detail.js:
export default class Detail extends React.Component {
render() {
return (
<View>
<Text style={styles.headerText}>Details of the content</Text>
</View>
)
}
}
Run Code Online (Sandbox Code Playgroud)
我想有两个屏幕(NowList和SoonList)基本上是相同类型的列表,所以我对屏幕使用相同的List组件.从这些屏幕中的每个屏幕,我想导航到项目的详细信息,在这种情况下也具有相同类型的布局,因此我对列表项使用了Detail组件.
最后,当应用程序启动时,我希望显示NowList屏幕.使用抽屉我想导航到SoonList屏幕.
我不知道如何配置这条路线.但是,这就是我现在配置路线的方式:
const NowStack = StackNavigator({
NowList: {
screen: List,
navigationOptions: {
title: 'Now',
}
},
Detail: {
screen: Detail,
navigationOptions: {
title: 'Detail', …
Run Code Online (Sandbox Code Playgroud) 我试图在我的数据表中放置一个 foreach 循环,但它不起作用,PS 如果我删除 foreach 一切正常,这里附上我的代码
$Product = Product::query();
$colors = Color::all();
return Datatables::eloquent($Product)
->addColumn('category_name', function($row) {
$category = Category::select('name')->where('id', $row->category_id )->pluck('name')->toArray();
return $category;
})
->addColumn('add_color', function($row) {
$return =
'<form class="form-inline" method="post" action="/procurement/add-product" style="max-width: 170px;">
<input type="hidden" name= "product_id" value="' . $row->id . '">
<div class="form-group">
<select name="color_id" class="form-control" required autofocus>
'.foreach ($colors as $color){.'
<option value="test">test</option>'.}.'
</select>
</div>';
return $return;
});
Run Code Online (Sandbox Code Playgroud) 我不知道我是否误解了什么,但我在文件上传过程中调用了以下方法:
$cover->storePubliclyAs($coverAsset->dir, $coverAsset->preview_name);
Run Code Online (Sandbox Code Playgroud)
$coverAsset->dir
返回businesses/2
并$coverAsset->preview_name
返回一个散列的文件名。
上传后,我最终得到一个文件:
storage/app/businesses/1/pre-AxDMVlSN.jpeg
我很困惑,为什么文件没有保存在storage/app/public/businesses/...
?我希望“公开”部分将它放在 Laravel 提供的存储目录结构的公共文件夹中。
我查看了我的文件系统配置:
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
],
...
Run Code Online (Sandbox Code Playgroud)
感觉local
是用磁盘而不是public
磁盘?我如何找出UploadedFile->storePubliclyAs
方法使用了哪一个?