定义方法

export default function editRouteQuery(route, query = null) {
  const _old = route.query
  let _new = query

  if (query) {
    _new = Object.assign({}, _old, query)
  }

  for (const key in _new) {
    if (!_new[key]) {
      delete _new[key]
    }
  }

  return {
    ...route,
    query: _new
  }
}

vue页面引用

// 钩子
created() {
    this.$nextTick(() => {
      this.listQuery = Object.assign(this.listQuery, this.$route.query)
    })
}

// methods
resetForm() {
      this.$router.replace(
        editRouteQuery(this.$route, { announcementName: '' })
      )
}