| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- Component({
- properties: {
- list: {
- type: Array
- },
- showList: {
- type: Array
- },
- getResult: {
- type: Function
- }
- },
- options: {
- addGlobalClass: true
- },
- data: {
- show: false,
- result: []
- },
- lifetimes: {
- attached: function () {
- getApp().globalData.Language.getLanguagePackage(this)
- }
- },
- methods: {
- onChange({
- detail
- }) {
- this.setData({
- result: detail
- })
- },
- onClose() {
- this.setData({
- show: false
- })
- },
- startSearch({
- detail
- }) {
- if (!detail.trim()) return this.setData({
- showList: this.data.list
- })
- let showList = this.data.list.filter(v => `${v.projectname},${v.projectnum},${v.address}`.includes(detail.trim()));
- this.setData({
- showList
- })
- },
- onClear() {
- this.setData({
- showList: this.data.list
- })
- },
- handleReturn() {
- if (!this.data.result.length) return;
- this.triggerEvent("getResult", this.data.result)
- this.setData({
- show: false,
- result: []
- })
- }
- }
- })
|