An alternative to the Dropdown component’s clickback failure

//html
<el-dropdown trigger="click">
	  <span class="el-dropdown-link">The drop-down menu<i class="el-icon-arrow-down el-icon--right"></i>
	  </span>
	  <el-dropdown-menu slot="dropdown">// Wrap a div or view around the menu item, bind the click event, pass in the index or ID, and get the corresponding menu item<view @click="handleCommand(index)" class="" v-for="(item, index) in 5" :key="index">
				<el-dropdown-item>A menu item</el-dropdown-item>
		  </view>
	  </el-dropdown-menu>
</el-dropdown>

Copy the code
handleCommand(index) {
        console.log(index);
}
Copy the code

Note: This component is used in the UniApp Vue component