0
点赞
收藏
分享

微信扫一扫

正则判断输入的是数字还是中文

    async remoteMethod(query) {
      if (query !== '') {
        if (/[\u4e00-\u9fa5]/.test(query)) {
          const res = await getCinemaList({
            pageNum: 1,
            cinemaName: query
            // zzCode: query
          });
          this.loading = true;
          this.cinemaOptions = [];
          for (const item of res.data.list) {
            this.cinemaOptions.push({
              label: item.name,
              value: item.id
            });
          }
          this.loading = false;
        } else {
          const res = await getCinemaList({
            pageNum: 1,
            zzCode: query
          });
          this.loading = true;
          this.cinemaOptions = [];
          for (const item of res.data.list) {
            this.cinemaOptions.push({
              label: item.name,
              value: item.id
            });
          }
          this.loading = false;
        }
      } else {
        this.cinemaOptions = [];
      }
    },```

举报

相关推荐

0 条评论