add editor
This commit is contained in:
@ -94,6 +94,7 @@ Component<JournalListData, {}, {}, ComponentInstance>({
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
/** 重置搜索页面 */
|
||||
resetPage() {
|
||||
const likeExample = this.data.searchValue ? {
|
||||
idea: this.data.searchValue,
|
||||
@ -116,6 +117,7 @@ Component<JournalListData, {}, {}, ComponentInstance>({
|
||||
isFinished: false
|
||||
});
|
||||
},
|
||||
/** 获取数据 */
|
||||
fetch() {
|
||||
if (this.data.isFetching || this.data.isFinished) {
|
||||
return;
|
||||
@ -159,19 +161,16 @@ Component<JournalListData, {}, {}, ComponentInstance>({
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 输入搜索 */
|
||||
onSearchChange(e: WechatMiniprogram.CustomEvent) {
|
||||
const value = e.detail.value.trim();
|
||||
this.setData({ searchValue: value });
|
||||
// 如果是清空操作,不使用防抖(clear 事件会处理)
|
||||
if (value === "" && this.debouncedSearch) {
|
||||
this.debouncedSearch.cancel();
|
||||
return;
|
||||
}
|
||||
// 使用防抖自动搜索
|
||||
// 使用防抖自动搜索(包括清空的情况)
|
||||
if (this.debouncedSearch) {
|
||||
this.debouncedSearch(value);
|
||||
}
|
||||
},
|
||||
/** 提交搜索 */
|
||||
onSearchSubmit(e: WechatMiniprogram.CustomEvent) {
|
||||
const value = e.detail.value.trim();
|
||||
// 立即搜索,取消防抖
|
||||
@ -180,6 +179,7 @@ Component<JournalListData, {}, {}, ComponentInstance>({
|
||||
}
|
||||
this.resetAndSearch(value);
|
||||
},
|
||||
/** 清空搜索 */
|
||||
onSearchClear() {
|
||||
// 取消防抖,立即搜索
|
||||
if (this.debouncedSearch) {
|
||||
@ -187,6 +187,11 @@ Component<JournalListData, {}, {}, ComponentInstance>({
|
||||
}
|
||||
this.resetAndSearch("");
|
||||
},
|
||||
/** 保留搜索关键字重新搜索 */
|
||||
reSearch() {
|
||||
this.resetAndSearch(this.data.searchValue);
|
||||
},
|
||||
/** 重置配置重新搜索 */
|
||||
resetAndSearch(keyword: string) {
|
||||
const likeExample = keyword ? {
|
||||
idea: keyword,
|
||||
|
||||
Reference in New Issue
Block a user