| 1234567891011121314151617181920212223242526272829303132333435 |
- // pages/sync/sync.js
- import { fetchRomms } from './shared/api/index'
- import util from '../../utils/util.js';
- Page({
- data: {
- list: [],
- filterList: [],
- keyword: '',
- imgServer: util.imgServer,
- },
- onShow: async function (options) {
- const list = await fetchRomms()
- this.setData({ list })
- this.setFilterList()
- },
- setFilterList() {
- this.setData({
- filterList: this.data.list.filter(
- room => room.title && room.title.includes(this.data.keyword)
- )
- })
- },
- inputChange(ev) {
- this.setData({ keyword: ev.detail.value })
- this.setFilterList()
- },
- gotoRoom: function (event) {
- const { id } = event.currentTarget.dataset
- wx.navigateTo({
- url: `/pages/sync/room/room?id=${id}`,
- })
- }
- })
|