我一直在用纯原生 html 和 php 开发一个项目,我想将其转移到 laravel。现在,当我想在另一个页面(另一个刀片文件)内显示 iframe(刀片文件)时,我陷入了困境。父页面正在显示,但 iframe 出现 404(未找到)错误。下面是我的代码:
请注意,这两个文件位于“view”目录中的同一文件夹中。
父.blade.php
<iframe src="child.blade.php">Your browser isn't compatible</iframe>
路线
Route::group(['prefix' => 'parent'], function () {
Route::get('/', 'ParentController@index');
Route::get('/child', 'ParentController@child');
});
Run Code Online (Sandbox Code Playgroud)
控制器
public function index()
{
return view('folder/index');
}
public function child()
{
return view('folder/child');
}
Run Code Online (Sandbox Code Playgroud) 所以在 Reactjs 类组件中,我的状态有一个数组,如下所示:
myArray: [
{ number: 1, title: 'Users', image: '../../../assets/images/website/homepage/users.png' },
{ number: 2, title: 'Clients', image: '../../../assets/images/website/homepage/clients.png' },
{ number: 3, title: 'Admin', image: '../../../assets/images/website/homepage/admins.png' },
]
Run Code Online (Sandbox Code Playgroud)
我这样映射数组:
{this.state.myArray.map((item, index) => (
<Box key={index} className="col-sm-12">
<img src={ item.image } className="img-fluid" alt={item.title} />
<Typography variant="h4">{item.number}</Typography>
</Box>
))}
Run Code Online (Sandbox Code Playgroud)
现在,一切正常,除了图像不显示,我真的不明白我哪里出错了。
请注意,如果我使用 require 方法直接将图像链接之一复制到 src 内,则它可以工作。请帮忙。
假设我有一个像这样的对象数组。
const top100Films = [
{ title: 'The Shawshank Redemption', year: 19 },
{ title: 'The Godfather', year: 19 },
{ title: 'The Godfather: Part II', year: 19 },
{ title: 'The Dark Knight', year: 20 },
{ title: '12 Angry Men', year: 19 },
{ title: "Schindler's List", year: 20 },
{ title: 'Pulp Fiction', year: 20 },
{ title: 'The Lord of the Rings: The Return of the King', year: 20 },
{ title: 'The Good, the Bad …Run Code Online (Sandbox Code Playgroud)