search.page.js
891 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
const Vue = require('yoho-vue');
const $ = require('yoho-jquery');
const qs = require('yoho-qs');
const search = require('product/search.vue');
$(function() {
const buildFilters = function() {
return $.get('filters.json', qs);
};
const buildSort = function() {
return [
{
txt: '默认',
val: 1
}, {
txt: '最新',
val: 2
}, {
type: 'updown',
txt: '价格',
val: [3, 4] // [up, down]
},
{
type: 'updown',
txt: '折扣',
val: [5, 6]
}
];
};
let app = new Vue(search);
buildFilters()
.then(filterConfig => {
app.filterConfig = filterConfig;
});
app.sortConfig = buildSort();
});