search.page.js 891 Bytes
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();
});