<!DOCTYPE html>
<html lang="en">
<head>
<meta charset = "UTF-8">
<title>加入对比测试</title>
<style>
[v-cloak]{display: none;}
a{text-decoration: none;color:#00f}
.center{text-align: center;}
.disabled{cursor:not-allowed;color:#999;pointer-events: none;}
</style>
</head>
<body>
<div id="app" v-cloak>
<table border="1" align=center cellspacing="0" width="500">
<caption align="center"><b>规格设置</b></caption>
<tr>
<th>名称</th>
<th>价格</th>
<th>操作</th>
</tr>
<template v-if="lists && lists.length>0">
<tr v-for="(item,index) in lists" :key="item.id">
<td>{
{item.name}}</td>
<td>{
{item.price}}</td>
<td class="center"><a href="javascript:;" @click="addCompare(index,item)">加入对比>></a></td>
</tr>
</template>
<tr v-if="lists.length==0"><td colspan="3" class="center">暂无记录</td></tr>
<
vue 加入对比 3种方法
最新推荐文章于 2024-07-07 17:07:20 发布
本文介绍了在Vue.js中进行元素比较的三种技术:1) 使用includes()方法,2) 利用findIndex()查找,3) 结合watch()进行监控和比较。
摘要由CSDN通过智能技术生成