在Laravel Nova中选择图像

时间:2018-09-28 12:25:05

标签: javascript html laravel select

我正在使用Laravel Nova,并且正在尝试制作多重引导image软件包。

您需要选择主photos并将其作为avatar

目前的问题是,当您单击photo(而不是单选按钮)时,总是有第一张照片,为什么?

  <template>
    <default-field :field="field">
        <template slot="field">
            <div class="mb-6">
                <template>
                    <div class="uploader"
                        @dragenter="OnDragEnter"
                        @dragleave="OnDragLeave"
                        @dragover.prevent
                        @drop="onDrop"
                        :class="{ dragging: isDragging }">

                        <div class="upload-control" v-show="images.length">
                            <label for="file">Добавить файл</label>
                        </div>

                        <div v-show="!images.length">
                            <i class="fa fa-cloud-upload"></i>
                            <p>Перетащи</p>
                            <div>или</div>
                            <div class="file-input">
                                <label for="file">выбери файл</label>
                                <input type="file" id="file" @change="onInputChange" multiple>
                            </div>
                        </div>
                        <div class="images-preview" v-show="images.length">
                            <draggable class="dragArea" :options="{group:'images'}">
                                    <div class="img-wrapper" v-for="(image, index) in images" :key="index">
                                        <input type="radio" name="image" id="main"/>
                                        <label for="main">
                                        <img :src="image" :alt="`Image Uploader ${index}`">
                                        </label>
                                        <div class="details">
                                            <span class="name" v-text="files[index].name"></span>
                                            <span class="size" v-text="getFileSize(files[index].size)"></span>
                                            <button v-on:click="remove(index)">❌</button>
                                        </div>
                                    </div>
                            </draggable>
                        </div>
                    </div>
                </template>
            </div>
        </template>
    </default-field>
</template>

0 个答案:

没有答案