如何在Java脚本中将返回值放入URL中

问题描述 投票:0回答:1

我已经有了父页面的“ breedKey”值和返回的“ thedate”值,如何将这两个值放入axios.get URL中,我想用这种方式在URL中替换它们

https://www.mustavi.com/TimeSeries/?param1={{breedkey}}&param2 = {{thedate}}”]

   props: ["breedKey", "time"],

    data() {
            return {
              thedate: this.time
            };
          },

    async created() {

            let myparam1 = breedKey;
            let myparam2 = thedate;

            try {
              this.promise = axios.get(
                "https://www.mustavi.com/TimeSeries/?param1=nctzenselcaday&param2=2020-04-09"
              );
              const res = await this.promise;
javascript vue.js url url-rewriting vue-component
1个回答
0
投票

您可以为此使用template strings

this.promise = axios.get(
 `https://www.mustavi.com/TimeSeries/?param1=${myparam1}&param2=${myparam2}`
);
© www.soinside.com 2019 - 2024. All rights reserved.