首页 > 其他分享 >bug记录:输入框延迟、卡顿

bug记录:输入框延迟、卡顿

时间:2024-02-18 10:47:47浏览次数:22  
标签:存储 saveQueryParamsFn initDataMixin 签时 bug 输入框 查询 queryParams 卡顿

问题场景

离开本页签时(即点击其他页签时),存储查询数据。导致 bug:首次打开页签,或者点击浏览器按钮刷新时后,页面上的输入框输入后,会出现无法输入、延迟显示、输入卡顿。

image

代码如下:

  /* === initDataMixin.js === */
  beforeRouteLeave(to, from, next) {
    // 跳转路由之前,存储滚动条位置
    this.$store.dispatch("queryData/changeQuery", {
      key: "scrollY",
      value: {
        [from.path]: window.scrollY,
      },
    });
    // 离开本页签时(即点击其他页签时),存储查询数据
    this.saveQueryParamsFn();
    next();
  },
  methods: {
    // 保存查询参数
    saveQueryParamsFn() {
      this.$store.dispatch("queryData/changeQuery", {
        key: "queryParams",
        value: {
          [this.path]: this.queryParams,
        },
      });
    },
  },

修改

改为:发送查询请求后,存储查询数据。上述 bug 消失。

代码如下:

  /* === initDataMixin.js === */
  beforeRouteLeave(to, from, next) {
    // 跳转路由之前,存储滚动条位置
    this.$store.dispatch("queryData/changeQuery", {
      key: "scrollY",
      value: {
        [from.path]: window.scrollY,
      },
    });
    next();
  },
  methods: {
    // 保存查询参数  // initData() 方法末尾(即发送查询请求后调用),存储查询数据
    saveQueryParamsFn() {
      this.$store.dispatch("queryData/changeQuery", {
        key: "queryParams",
        value: {
          [this.path]: this.queryParams,
        },
      });
    },
  },
/* === 使用 initDataMixin 的 vue 页面  === */
methods: {
    // 根据 initDataMixin,必须要有 initData()
    initData() {
      this.loadPage();
    },
    // 加载页面
    loadPage() {
      // 请求查询接口数据
      // ……
      // 存储查询参数
      this.saveQueryParamsFn();
    },
}

标签:存储,saveQueryParamsFn,initDataMixin,签时,bug,输入框,查询,queryParams,卡顿
From: https://www.cnblogs.com/shayloyuki/p/18018890

相关文章

  • Pygame 播放背景音乐卡顿
    Pygame是常用的游戏开发库之一。然而在使用Pygame的过程中,却出现了播放背景音乐卡顿的问题。表现为咯咯咯的噪音。检查Pygame版本,为2.5.2。降级至1.9.6,此时代码报错:Traceback(mostrecentcalllast):File"D:\MyWork\Code_Learning\PythonLearning\Pygame\test2.py",line......
  • C++文件输入输出的简单实现(Debug)
    1.前言:        文件输入输出是个很有用的东西,有时比赛时要有:要求使用文件输入输出,还有时候……    遇到这种时间限制非常恶心的题目:手动测试会有误差……    文件输入输出是个很好的选择!2.写法:C    C语言的写法有点复杂,涉及文件指针,本文不......
  • bug-missing GOSUMDB
     问题描述:D:\gopj>gomodtidygo:findingmoduleforpackagego.uber.org/zapgo:findingmoduleforpackagegithub.com/valyala/fasthttpgo:downloadinggo.uber.org/zapv1.26.0go:downloadinggithub.com/valyala/fasthttpv1.52.0go:githun.com/bigwh......
  • Debug: tf distribute strategy parameter server: tfx component trainer: OutOfRang
    [ERROR:tfdistributestrategyparameterserver:tfxcomponenttrainer:OutOfRangeError(),Node:'cond/IteratorGetNext'Endofsequence]logofpodtfx-component-trainer:2024-02-1409:43:48.571820:W./tensorflow/core/distributed_runtime/eager/......
  • Keil5在Debug下如何实时查看变量的值
    在Debug模式下查看某个变量的值很简单,只需把需要查看的变量添加到watch,有一点要注意的是该变量必须是全局变量才能实时显示,具体操作如下图。1、把鼠标光标移到要查看的变量处;2、点击鼠标右键,在弹出的窗口中选择Add‘ADC _Value’to;3、选择显示的窗口,有两个窗口选择。变量......
  • Debug: tf distribute strategy parameter server: NOT_FOUND: No such file or dire
    [ERROR:NOT_FOUND:/tfx/tfx_pv/pipelines/detect_anomolies_on_wafer_tfdv_schema/ImportExampleGen/examples/67/Split-train/data_tfrecord-00000-of-00001.gz;Nosuchfileordirectory]logofpodtfx-trainer-component:ERROR:tensorflow:/job:worker/task:0en......
  • Debug : kfp.Client().upload_pipeline(): Failed to start a transaction to create
    [ERROR:Failedtostartatransactiontocreateanewpipelineandanewpipelineversion:dialtcp:lookupmysqlon10.96.0.10:53:nosuchhost","]>>>kfp.Client().upload_pipeline("/home/maye/pipeline_wafer_distribute.yaml",......
  • Debug: tf distribute strategy parameter server: stuck at "INFO:tensorflow:Parame
    [ERROR:stuckat"INFO:tensorflow:ParameterServerStrategyV2isnowconnectingtoclusterwithcluster_spec:ClusterSpec({'ps':['dist-strat-example-ps-0:5000'],'worker':['dist-strat-example-worker-0:5000',&#......
  • Debug: tf_ditribute_strategy_worker.yaml: unknown field "spec.template.spec.node
    [ERROR:unknownfield"spec.template.spec.nodeAffinity"](base)maye@maye-Inspiron-5547:~/github_repository/tensorflow_ecosystem/distribution_strategy$kubectlapply-fmaye_template.yamlservice/dist-strat-example-worker-0createdservice/dis......
  • Debug: tf_ditribute_strategy_worker.yaml: resource mapping not found for name:
    [ERROR:resourcemappingnotfoundforname:"dist-strat-example-worker-0"namespace:""from"maye_template.yaml":nomatchesforkind"Deployment"inversion"v1"]apiVersion:apps/v1kind:Deploymentme......