12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- import { VueLikePage } from '../../utils/page'
- import GoodsApi from '../../apis/goods'
- import Router from '../../utils/routes'
- VueLikePage([], {
- data: {
- items: [],
- itemsShowList: []
- },
- methods: {
- onShow () {
- this.getGoodsList()
- },
- bindinput (e) {
- const value = e.detail
- this.setData({
- itemsShowList: this.data.items.filter(item => item.title.indexOf(value) > -1)
- })
- },
- getGoodsList () {
- GoodsApi.getCollectedGoods().then(res => {
- const list = res.data.list.map(item => {
- item.img_url = item.listPicUrl,
- item.title = item.name
- item.desc = item.specifications
- return item
- })
- this.setData({
- items: list,
- itemsShowList: list
- })
- })
- },
- search (e) {
- const value = e.detail
- },
- toDetail (e) {
- const { id } = e.currentTarget.dataset
- Router.push({
- url: 'goodsDetail',
- query: {
- goods_id: id
- }
- })
- }
- }
- })
|