简体   繁体   English

Vuetify扩展面板主体在测试环境中没有显示任何样式

[英]Vuetify expansion panel body has display none style in testing environment

Hello I'm currently having trouble in debugging an issue on my testing site, what happened is that the expansion panels are not showing because of some style attribute is attached to the div element of v-expansion-panel__body . 您好,我目前无法在测试站点上调试问题,发生的事情是由于某些样式属性附加到v-expansion-panel__body的div元素而导致扩展面板未显示。 This doesn't happen on my local. 这在我本地没有发生。 Both executes npm run build in building the app. 两者都在构建应用程序时执行npm run build

在此处输入图片说明

Below are my codes 以下是我的代码

Template 模板

<v-expansion-panel
                    light
                    class="elevation-0">
                    <v-expansion-panel-content
                        v-for="(acl, moduleIndex) in aclModuleAndActionItems"
                        :key="moduleIndex">
                        <template v-slot:header>
                            <div>
                                <h3>
                                    {{acl.module_name}}
                                </h3>
                            </div>
                        </template>
                        <v-card
                            flat 
                            class="elevation-0">
                            <v-card-text class="pa-0">
                                <div 
                                    v-for="(action, actionIndex) in acl.action_names" 
                                    :key="actionIndex">
                                    <div class="pl-5">
                                        <v-checkbox
                                            :disabled="!role"
                                            :label="action | underscoretospace"
                                            color="green"
                                            class="pt-2 pb-2 pl-5 pr-4"
                                            @change="validateAclRole($event, role, acl.module_name, action)">
                                        </v-checkbox>
                                    </div>
                                    <v-divider v-if="actionIndex < (acl.action_names.length - 1)"></v-divider>
                                </div>
                            </v-card-text>
                        </v-card>
                    </v-expansion-panel-content>
                </v-expansion-panel>

Script 脚本

<script>
import { AclModuleAndActionItems } from '~/static/AclModuleAndActionItems.js'

export default {
    data() {
        return {
            aclModuleAndActionItems: ( AclModuleAndActionItems ) ? AclModuleAndActionItems : [],
            role: ''
        }
    }
}
</script>

ACL Array ACL阵列

export const AclModuleAndActionItems =  [
    {
        "module_name": "acl",
        "action_names": [
            "create",
            "destroy",
            "edit",
            "index",
            "show",
            "store",
            "update"
        ]
    },
    {
        "module_name": "projects",
        "action_names": [
            "create",
            "destroy",
            "edit",
            "index",
            "show",
            "store",
            "update"
        ]
    },
    {
        "module_name": "tasks",
        "action_names": [
            "create",
            "destroy",
            "edit",
            "index",
            "pending_task",
            "show",
            "store",
            "update"
        ]
    }
]

Display on my local 在我的本地显示

在此处输入图片说明

Ended up using the below code for panel headers and the style attribute is not added anymore to expansion panel header. 最终使用以下代码作为面板标题,并且样式属性不再添加到扩展面板标题中。

<div slot="header">
    <h3>{{acl.module_name}}</h3>
</div>

Not sure why using template is adding the style attribute in my case 不知道为什么在我的情况下使用模板添加样式属性

<template v-slot:header>
    <div>
        <h3>{{acl.module_name}}</h3>
    </div>
</template>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM