搜索栏实现跳转查询
往生殿页面详细重定向到hall
This commit is contained in:
parent
87d8b28193
commit
d8bb3953ba
|
|
@ -43,13 +43,17 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
onInput(e) {
|
||||
// 只更新输入值,不触发搜索
|
||||
this.$emit('input', e.detail.value)
|
||||
},
|
||||
onSearch() {
|
||||
// 只在点击搜索按钮或按回车时触发搜索
|
||||
if (this.value.trim()) {
|
||||
this.$emit('search', this.value)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
|
|
|||
|
|
@ -67,13 +67,14 @@ export default {
|
|||
}
|
||||
},
|
||||
watch: {
|
||||
searchKeyword: {
|
||||
handler(newVal) {
|
||||
this.resetList()
|
||||
this.loadData()
|
||||
},
|
||||
immediate: false
|
||||
}
|
||||
// 移除对searchKeyword的自动监听,避免输入时自动刷新
|
||||
// searchKeyword: {
|
||||
// handler(newVal) {
|
||||
// this.resetList()
|
||||
// this.loadData()
|
||||
// },
|
||||
// immediate: false
|
||||
// }
|
||||
},
|
||||
mounted() {
|
||||
this.loadData()
|
||||
|
|
|
|||
|
|
@ -67,13 +67,14 @@ export default {
|
|||
}
|
||||
},
|
||||
watch: {
|
||||
searchKeyword: {
|
||||
handler(newVal) {
|
||||
this.resetList()
|
||||
this.loadData()
|
||||
},
|
||||
immediate: false
|
||||
}
|
||||
// 移除对searchKeyword的自动监听,避免输入时自动刷新
|
||||
// searchKeyword: {
|
||||
// handler(newVal) {
|
||||
// this.resetList()
|
||||
// this.loadData()
|
||||
// },
|
||||
// immediate: false
|
||||
// }
|
||||
},
|
||||
mounted() {
|
||||
this.loadData()
|
||||
|
|
|
|||
|
|
@ -96,6 +96,20 @@ export default {
|
|||
hasSearched: false
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
console.log('deceasedSearch页面接收到的参数:', options)
|
||||
|
||||
// 从路由参数获取搜索关键词
|
||||
if (options.keyword) {
|
||||
this.searchName = decodeURIComponent(options.keyword)
|
||||
console.log('接收到搜索关键词:', this.searchName)
|
||||
|
||||
// 自动执行搜索
|
||||
this.$nextTick(() => {
|
||||
this.handleSearch(this.searchName)
|
||||
})
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 处理搜索
|
||||
async handleSearch(value) {
|
||||
|
|
|
|||
|
|
@ -125,7 +125,21 @@ export default {
|
|||
handleSearch(value) {
|
||||
console.log('搜索内容:', value)
|
||||
this.searchName = value
|
||||
// 搜索逻辑由 enshrinedList 组件处理
|
||||
|
||||
// 跳转到往生者搜索页面并传递搜索关键词
|
||||
uni.navigateTo({
|
||||
url: `/pages/memorial/deceasedSearch?keyword=${encodeURIComponent(value)}`,
|
||||
success: () => {
|
||||
console.log('跳转到搜索页面成功')
|
||||
},
|
||||
fail: (error) => {
|
||||
console.error('跳转失败:', error)
|
||||
uni.showToast({
|
||||
title: '页面跳转失败',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 处理列表项点击
|
||||
|
|
|
|||
|
|
@ -271,10 +271,21 @@ export default {
|
|||
async handleSearch(value) {
|
||||
console.log('搜索内容:', value)
|
||||
this.searchName = value
|
||||
// 重置页码
|
||||
this.pageParams.pageNum = 1
|
||||
// 重新获取数据
|
||||
await this.getDeceasedList()
|
||||
|
||||
// 跳转到往生者搜索页面并传递搜索关键词
|
||||
uni.navigateTo({
|
||||
url: `/pages/memorial/deceasedSearch?keyword=${encodeURIComponent(value)}`,
|
||||
success: () => {
|
||||
console.log('跳转到搜索页面成功')
|
||||
},
|
||||
fail: (error) => {
|
||||
console.error('跳转失败:', error)
|
||||
uni.showToast({
|
||||
title: '页面跳转失败',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 处理查看详情
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user