123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- Component({
- externalClasses: ['list-class'],
- properties: {
- template: String,
- templateData: Object,
- request: Object,
- reload: Object,
- warp: Boolean,
- templateList: Array
- },
- observers: {
- reload(o) {
- this._reload && this._reload(o);
- }
- },
- methods: {
- getItems({
- detail: {
- items
- }
- }) {
- let {
- data: {
- list
- }
- } = this;
- this.setData({
- list: [...(list || []), ...items]
- })
- wx.stopPullDownRefresh();
- },
- update({
- detail: {
- type
- },
- currentTarget: {
- dataset: {
- index
- }
- }
- }) {
- let {
- data: {
- list = []
- }
- } = this;
- type == "del" && list.splice(index, 1)
- this.setData({
- list
- })
- this.triggerEvent("change")
- },
- reload({
- detail: {
- reload
- }
- }) {
- this._reload = () => {
- this.setData({
- list: null
- })
- reload()
- };
- },
- loadCompletion({ detail: { completion } }) {
- this.setData({
- completion
- })
- }
- }
- })
|