我正在使用 Vue.js 版本 3。这是我的完整代码,其中包含虚拟数据和带有过滤器和排序的选项 API,一切都运行良好
<template>
<h5>List of Products</h5>
<h3>Filter</h3>
<button v-on:click="resetOptions">Reset</button>
<button v-on:click="sorting">Sorting</button>
<button v-on:click="sorting2">Sorting2</button>
<select v-model="category">
<option value="Accessories">Accessories</option>
<option value="Laptop">Laptop</option>
<option value="Stationary">Stationary</option>
</select>
<div>
<input type="checkbox" name="test" id="test" v-model="city" value='Roma' />
<label for="test"> Roma</label>
<input type="checkbox" name="test2" id="test2" v-model.trim="city" value='Barselona' />
<label for="test2"> Barselona</label>
<input type="checkbox" name="test3" id="test3" v-model.trim="city" value='Milano' />
<label for="test3"> Milano</label>
</div>
<!-- <select v-model="city">
<option value="Barselona">Barselona</option>
<option value="Roma"> Roma </option>
<option value="Milano">Milano</option>
</select> -->
<input type="text" v-model="name" placeholder="Filter By Name"/>
<label for="vol">Price (between 0 …
Run Code Online (Sandbox Code Playgroud)