Property or method "logout" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.
使用官方给的方式,有效。
<el-dropdown @command="handleCommand">
  <span class="el-dropdown-link">
    下拉菜单<i class="el-icon-arrow-down el-icon--right"></i>
  </span>
  <el-dropdown-menu slot="dropdown">
    <el-dropdown-item command="a">黄金糕</el-dropdown-item>
    <el-dropdown-item command="b">狮子头</el-dropdown-item>
    <el-dropdown-item command="c">螺蛳粉</el-dropdown-item>
    <el-dropdown-item command="d" disabled>双皮奶</el-dropdown-item>
    <el-dropdown-item command="e" divided>蚵仔煎</el-dropdown-item>
  </el-dropdown-menu>
</el-dropdown>
<style>
  .el-dropdown-link {    
cursor: pointer;    
color: #409EFF;
  }  
.el-icon-arrow-down {    
font-size: 12px;
  }
</style>
<script>
  export default {    
      methods: {
        handleCommand(command) {        
        this.$message('click on item ' + command);
        }
      }
  }
</script> 
 
0条评论
我要评论