商品品牌分页过滤排序查询的完成流程
Posted newcityboy
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了商品品牌分页过滤排序查询的完成流程相关的知识,希望对你有一定的参考价值。
//1、首先分析前台页面的请求,从中获取四要素:请求方式、请求参数、请求路径、返回值类型 2、书写controller、service、mapper、pojo
//品牌页面
<template>
<div>
<v-layout class="px-2">
<v-flex xs2>
<v-btn color="info" small>新增品牌</v-btn>
</v-flex>
<v-spacer/>
<v-flex xs4>
<v-text-field label="搜索" hide-details append-icon="search" v-model="key"></v-text-field>
</v-flex>
</v-layout>
<v-data-table
:headers="headers"
:items="brands"
:pagination.sync="pagination"
:total-items="totalBrands"
:loading="loading"
class="elevation-1"
>
<template slot="items" slot-scope="props">
<td class="text-xs-center">{{props.item.id}}</td>
<td class="text-xs-center">{{props.item.name}}</td>
<td class="text-xs-center"><img :src="props.item.image" alt=""/></td>
<td class="text-xs-center">{{props.item.letter}}</td>
<td class="text-xs-center">
<v-btn flat icon color="info">
<v-icon>edit</v-icon>
</v-btn>
<v-btn flat icon color="error">
<v-icon>delete</v-icon>
</v-btn>
</td>
</template>
error
</v-data-table>
</div>
</template>
<script>
export default {
name: "my-brand",
data() {
return {
headers: [
{text: "品牌ID", value: "id", align: "center", sortable: true},
{text: "品牌名称", value: "name", align: "center", sortable: false},
{text: "品牌LOGO", value: "image", align: "center", sortable: false},
{text: "品牌首字母", value: "letter", align: "center", sortable: true},
{text: "修改,删除", align: "center", sortable: false},
],
brands: [],
pagination: {},
totalBrands: 0,
loading: false,
key:"", //搜索条件
}
},
created() {
this.brands = [
{id: 2032, name: "OPPO", image: "1.jpg", letter: "O"},
{id: 2033, name: "飞利浦", image: "2.jpg", letter: