【问题标题】:Laravel Nova - Display text area content without option show contentLaravel Nova - 显示没有选项显示内容的文本区域内容
【发布时间】:2019-02-23 14:54:21
【问题描述】:

我想始终显示文本区域资源字段内容而不显示选项“显示内容”或默认显示。

有可能吗?

【问题讨论】:

    标签: laravel laravel-5.6 laravel-nova


    【解决方案1】:

    自 v1.1.4 起

    现在有一个始终显示的选项。

    Textarea::make('Title')->alwaysShow()
    

    从 v1.0.19 开始

    你不能。如果你看看TextareaField.vue (nova/resources/js/components/Detail/TextareaField.vue):

    <template>
        <panel-item :field="field">
            <template slot="value">
                <excerpt :content="field.value" />
            </template>
        </panel-item>
    </template>
    

    那么如果你看看Excerpt.vue (nova/resources/js/components/Excerpt.vue):

    <div v-if="hasContent">
        <div v-if="expanded" class="markdown leading-normal" v-html="content" />
    
        <a
            @click="toggle"
            class="cursor-pointer dim inline-block text-primary font-bold"
            :class="{ 'mt-6': expanded }"
            aria-role="button"
        >
            {{ showHideLabel }}
        </a>
    </div>
    

    以及vue的props:

    props: {
        content: {
            type: String,
        },
    },
    
    data: () => ({ expanded: false }),
    

    没有传递扩展属性的选项。

    【讨论】:

    • 我已经更新了你的答案,因为新版本可以选择这样做
    猜你喜欢
    • 2019-07-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-12-22
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多