Vuetify Menu not working: Property or method “on” is not defined on the instance but referenced during render

大城市里の小女人 提交于 2019-12-10 13:21:34

问题


I am copying an first example from the official documentation Vuetify about Menus, but the result is an error :

"Property or method "on" is not defined on the instance but referenced during render".

<template>
        <v-app>
            <div class="text-xs-center">
                <v-menu offset-y>
                    <template v-slot:activator="{ on }">
                        <v-btn
                                color="primary"
                                dark
                                v-on="on"
                        >
                            Dropdown
                        </v-btn>
                    </template>
                    <v-list>
                        <v-list-tile
                                v-for="(item, index) in items"
                                :key="index"
                                @click=""
                        >
                            <v-list-tile-title>{{ item.title }}</v-list-tile-title>
                        </v-list-tile>
                    </v-list>
                </v-menu>
            </div>
        </v-app>
    </template>
    
    <script>
        export default {
            data: () => ({
                items: [
                    { title: 'Click Me' },
                    { title: 'Click Me' },
                    { title: 'Click Me' },
                    { title: 'Click Me 2' }
                ]
            })
        }
    </script>

回答1:


I had the same issue in Vuetyfy 1.4.4 and Vue 2.5. Updating this packages fixed problem. In vue 2.6.9 and vuetify 1.5.6 attribute v-slot:activator="{ on }" works great. Check your outdated packages by npm outdated --depth=0 and then update them by npm update vuetyfy vue etc.



来源:https://stackoverflow.com/questions/55136999/vuetify-menu-not-working-property-or-method-on-is-not-defined-on-the-instance

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!