小编Ado*_*ene的帖子

Laravel-使用变量重定向并将其显示在视图文件中

我有一个控制器

 public function store(Request $request)
{if ($request->input('asc')){
                $image = PropertyUser::where('user_id', '=', Auth::user()->id)->get();
                foreach($image as $property)
                {
                    $id = $property->property_id;
                }
                $image_ = Image::where('property_id', $id)->sortBy('description')->get();
                return redirect('settings/photos');
Run Code Online (Sandbox Code Playgroud)

我如何使用$image_变量重定向并将其显示在我的视图文件中

@foreach ($image_ as $images)
            <div class="image-warp"><img src="{{$images->filename}}"
                                         style="width:100px;height:100px;"><br/><span style="color: #1b1e21">{{$images->description}}</span>
            </div>
        @endforeach
Run Code Online (Sandbox Code Playgroud)

php laravel laravel-5

8
推荐指数
2
解决办法
5万
查看次数

Laravel - 保存在存储文件夹中的图像不显示给用户

我有这个代码在 storage/app/uploads 文件夹中保存图像

 $image_main = Image::where('property_id', $id)->get();

$file = $request->file('file');
      $destinationPath = 'uploads';
      $i = 0;
      foreach ($file as $file1) {
          $i++;
          $extension = $file1->getClientOriginalExtension();
          $path = $file1->storeAs(
              $destinationPath, $i.time().".".$extension
          );
Run Code Online (Sandbox Code Playgroud)

这是我的刀片文件

@foreach ($image_main as $images)
        <img src="{{"/storage/app/".$images->filename}}
Run Code Online (Sandbox Code Playgroud)

该文件保存在 storage/app/uploads 文件夹中,但没有向用户显示,它说找不到文件。我要在 filesystems.php 文件中设置任何内容吗

php laravel laravel-5

7
推荐指数
4
解决办法
3万
查看次数

为什么我的 Lottie 动画没有显示在我的 React-native 应用程序中?

我有一个反应本机视图,其中有 Lottie 动画,但动画根本不显示,屏幕只是黄色(封闭视图的背景色)。

这是我的代码:

import React, { Component } from 'react';
import {
  StyleSheet,
  View, 
} from 'react-native';
import LottieView from 'lottie-react-native';

export default class Splash extends Component {
  constructor(props) {
    super(props);
  }
    
  static navigationOptions = {
    header: null,
  };
    
  render() {
    return (
      <View style={{flex: 1, backgroundColor: 'yellow'}}>
        <LottieView
          style={{flex: 1}}
          source={require('../check.json')}
          autoPlay
          loop
        />
      </View>
    );
  }
}
Run Code Online (Sandbox Code Playgroud)

animation reactjs react-native lottie

3
推荐指数
2
解决办法
1万
查看次数

仅针对视图而非所有视图更改样式

我有一个<TouchableWithoutFeedback>封闭的视图,我想在点击它时改变这个封闭视图onPressIn的颜色即,但是所有视图的颜色都有变化,我的意思是映射视图,请问如何让onPressIn更改只有特定观点的风格并非全部

const herbs = this.state.record.map(herb => (
  <TTouchableWithoutFeedback
    onPressIn={() => this.setState({ pressed: !this.state.pressed })}
    key={herb.id}
  >
    <View style={this.state.pressed ? BackStyles.herbBox : BackStyles.herb_box}>
      <Image
        style={BackStyles.image}
        source={{ uri: `${herb.name.replace(/ /g, "")}` }}
      />
      <View style={{ flexDirection: "column" }}>
        <Text style={BackStyles.header}>{herb.name}</Text>
        <Text style={BackStyles.sub}>{herb.bot}</Text>
      </View>
    </View>
  </TTouchableWithoutFeedback>
));

const BackStyles = StyleSheet.create({
  herb_box: {
    backgroundColor: "#fff",
    borderRadius: 7,
    marginTop: 10,
    marginBottom: 10,
    flexDirection: "row",
    width: "95%",
    alignSelf: "center"
    //   height: '2%'
    //  justifyContent: 'center',
  },
  herbBox: {
    backgroundColor: "#28B564",
    borderRadius: …
Run Code Online (Sandbox Code Playgroud)

javascript css reactjs react-native

2
推荐指数
1
解决办法
153
查看次数

在函数中多次设置状态

我正在尝试通过使用更改状态this.setSTate但应用程序挂起并且状态继续设置,直到应用程序崩溃,请问可能有什么问题,我正在尝试在textbar函数中设置状态,状态的名称是attached. 这是我下面的代码

type Props = {};
export default class NewNote extends Component<Props> {
    static navigationOptions = {
        header: null,
        drawerLockMode: 'locked-closed'
    };
    constructor(props) {
        super(props);
        this.state = {
            photoPermission: '',
            songs: [], 
            loaded: true,
            loading: false,
            new_Press: false,
            text: '',
            selection: [0,0],
            pressed: false,
            boldButton: false,
            underlineButton: false,
            italicButton: false,
            attached: ''
        };
        this.textBar = this.textBar.bind(this);
      }
      componentDidUpdate(){ 
        if(this.state.pressed){
          this.TextInput.focus();  
        }
    }
    textinputter(){
    this.setState({pressed: true});

    }
    textBar(){
        const B = (props) => <Text style={{fontWeight: …
Run Code Online (Sandbox Code Playgroud)

reactjs react-native

1
推荐指数
1
解决办法
60
查看次数

标签 统计

react-native ×3

reactjs ×3

laravel ×2

laravel-5 ×2

php ×2

animation ×1

css ×1

javascript ×1

lottie ×1