UncleCaozy

3055 经验值

调过了 还没用 我把代码回退到了上节课,明天重新来一遍吧

确定,一点错误也没有 就是这样,出不来option,很烦恼。难道是样式加载顺序问题

确定,一点错误也没有 就是这样,出不来option,很烦恼。难道是样式加载顺序问题

会不会是编辑器ueditor的样式影响了select2的样式加载?

这是在app.blade.php头部引用的下载下来的select2的css和js

<!DOCTYPE html>
<html lang="{ app()->getLocale() }">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <script src="/js/jquery-3.2.1.min.js"></script>
    <link href="/css/select2.min.css" rel="stylesheet" />
    <script src="/js/select2.min.js"></script>
    <!-- CSRF Token -->
    <meta name="csrf-token" content="{ csrf_token() }">

    <title>知乎</title>

    <!-- Styles -->
    <link href="{ asset('css/app.css') }" rel="stylesheet">
</head>
@extends('layouts.app')

@section('content')
    @include('vendor.ueditor.assets')
    <div class="container">
        <div class="row">
            <div class="col-md-8 col-md-offset-2">
                <div class="panel panel-default">
                    <div class="panel-heading">发布问题</div>

                    <div class="panel-body">
                        <form action="/questions" method="post">
                            {!!csrf_field()!!}
                            <div class="form-group{ $errors->has('title') ? ' has-error' : '' }">
                                <label for="title">标题</label>
                                <input type="text" value="{old('title')}" name="title" class="form-control" placeholder="标题" id="title">
                                @if ($errors->has('title'))
                                    <span class="help-block">
                                        <strong>{ $errors->first('title') }</strong>
                                    </span>
                                @endif
                            </div>
                            <div class="form-group">
                                <select class="js-example-basic-multiple" multiple="multiple">
                                    <option value="AL">Alabama</option>
                                    <option value="WY">Wyoming</option>
                                </select>
                            </div>

                            <div class="form-group{ $errors->has('body') ? ' has-error' : '' }">
                                <label for="title">描述</label>
                                <script id="container" name="body" style="height:200px;" type="text/plain">
                                    {!! old('body') !!}
                                </script>
                                @if ($errors->has('body'))
                                    <span class="help-block">
                                        <strong>{ $errors->first('body') }</strong>
                                    </span>
                                @endif
                            </div>

                            <button class="btn btn-success pull-right" type="submit">发布问题</button>
                        </form>

                    </div>
                </div>
            </div>
        </div>

    </div><script type="text/javascript">
        var ue = UE.getEditor('container',{
            toolbars: [
                ['bold', 'italic', 'underline', 'strikethrough', 'blockquote', 'insertunorderedlist', 'insertorderedlist', 'justifyleft','justifycenter', 'justifyright',  'link', 'insertimage', 'fullscreen']
            ],
            elementPathEnabled: false,
            enableContextMenu: false,
            autoClearEmptyNode:true,
            wordCount:false,
            imagePopup:false,
            autotypeset:{ indent: true,imageBlockLine: 'center' }
        });
        ue.ready(function() {
            ue.execCommand('serverparam', '_token', '{ csrf_token() }'); // 设置 CSRF token.
        });
    </script>

    <script type="text/javascript">
        $(".js-example-basic-multiple").select2();
        
    </script>
@endsection

没报错 显示文件也都引用到了。我的情况是:我把下载下来的select2的js和css文件放在了public目录下的css和js文件里了,然后再app.blade.php视图上引用了,然后没报错,但是只出来框,不出来option选项

我全部引用到了之后 框也出来了 但是下面的option出不来