1234567891011121314151617181920212223242526272829303132333435363738 |
- let count = null;
- Component({
- properties: {
- inputSharch: {
- type: Function
- },
- selectSort: {
- type: Function
- }
- },
- data: {
- isClear: false
- },
- options: {
- addGlobalClass: true,
- },
- methods: {
- textChange(e) {
- clearTimeout(count);
- if (this.data.isClear) {
- this.triggerEvent("inputSharch");
- this.setData({
- isClear: false
- })
- return;
- }
- e.type == "change" ? count = setTimeout(() => this.triggerEvent("inputSharch", e.detail.trim()), 1000) : this.triggerEvent("inputSharch", e.detail.trim());
- },
- onClear() {
- this.setData({
- isClear: true
- })
- },
- handleSort() {
- this.triggerEvent("selectSort")
- },
- }
- })
|