使用我来自的url参数自动选择选项中的值 [英] Automatically select value in the options with the url parameters I am coming from

查看:83
本文介绍了使用我来自的url参数自动选择选项中的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,你好,请原谅我稍微差一点的英语





我想要,例如,如果我来了http://nesto.test/admin/post?main_title = post,自动选择值是'post',如果我带来http://nesto.test/admin/post?main_title = manifestacion,自动选择价值将是'表现'



我希望你明白我的意思,谢谢你提前



我尝试过:



index.blade.php





First of all, hello, and forgive me in a slightly worse English language


I want to, for example, if I come with http://nesto.test/admin/post?main_title=post, automatically select value is 'post', and if I come with http://nesto.test/admin/post?main_title=manifestacion , automatically select value will be 'manifestation'

I hope you understand what I want, thank you in advance

What I have tried:

index.blade.php


<div class="col-sm-6 col-xs-12">
                <div class="toolbar-tools pull-right">
                    <ul class="nav navbar-right">
                        @if(Entrust::can('add_post'))
                            <li>
                                @foreach($main_title_options as $option)
                                    <a href="{{ url('admin/post/create/' . $_GET['main_title']) }}" @if(isset($_GET['main_title']) && $_GET['main_title'] == $option->value)>

                                        
                                        {{ trans('labels.create_' . $option->value   ) }}
                                        @else
                                            {{ trans('labels.create_posts') }}
                                        @endif
                                        @endforeach

                                    </a>
                            </li>
                        @endif
                    </ul>
                </div>
            </div>







main_title.blade.php:






main_title.blade.php:

<div class="form-group">
                     <label for="main_title">{{ trans('labels.main_title') }}</label>
                     <select v-model="post.main_title | mainTitle" name="main_title"
                             id="main_title"
                             class="form-control">
                         @foreach($main_title_options as $option)
                             <option {{ $main_title == $option->value ? 'selected="selected"' : '' }} value="{{ $option->value }}">
                                 {{ trans('labels.'.$option->value) }}
                             </option>
                         @endforeach
                     </select>
                 </div>

推荐答案

main_title_options as
main_title_options as


选项)
< a href ={{url('admin / post / create /'。
option) <a href="{{ url('admin/post/create/' .


_GET ['main_title'])}}@ if(isset(
_GET['main_title']) }}" @if(isset(


这篇关于使用我来自的url参数自动选择选项中的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆