搜索和排序的功能都是通过计算属性:
1、搜索的主要通过filter过滤出符合条件的数据并保存起来
2、对符合条件的数据进行升降的排序,使用sort排序
<template>
<div class="content">
<!-- 头部 -->
<div class="header flex-row">
<div class="inner flex-row">
<span>价格排序</span>
<select v-model="sortStr">
<option class="options" value="1">价格从高到低</option>
<option class="options" value="0">价格从低到高</option>
</select>
<div class="flex-1"></div>
<input type="text" placeholder="搜索内容" v-model="keyword" />
<button>搜索</button>
</div>
</div>
<div class="flex">
<ul>
<li class="flex-row" v-for=