Javascript 发布后解码href URL链接并使用Vue.js重定向页面

Javascript 发布后解码href URL链接并使用Vue.js重定向页面,javascript,html,vue.js,vuejs2,vue-component,Javascript,Html,Vue.js,Vuejs2,Vue Component,我有一个两页的Vue.js设置示例。产品清单,然后是订单 问题1-从产品传递到订单页面输入的URL被编码。我尝试使用decodeURI()进行解码,但它仍然输出编码的结果 <a class="btn btn-primary btn-pill" v-bind:href="'order.html?product=' + decodeURI(item.title) + '&' ?price=' + decodeURI(item.price)" style="color:white;"

我有一个两页的Vue.js设置示例。产品清单,然后是订单

问题1-从产品传递到订单页面输入的URL被编码。我尝试使用decodeURI()进行解码,但它仍然输出编码的结果

<a class="btn btn-primary btn-pill" v-bind:href="'order.html?product=' + decodeURI(item.title) + '&' ?price=' + decodeURI(item.price)"  style="color:white;">Buy Now</a>
VUE


const app=新的Vue({
el:“#应用程序”,
数据:{
项目:[]
},
已创建:函数(){
fetch('listorder.json')
.then(resp=>resp.json())
。然后(项目=>{
这个项目=项目;
})
},
方法:{
重定向:函数(){
window.location.href=”https://www.paypal.me/wereallcatshere/USD“+项目价格;
}
}
});

请解释场景以及您想要获得的内容和您正在获得的内容?嗨,BB,目前正在获取编码URL,我希望这些内容能够被解码。其次,我想在POST完成后重定向到一个附加了“item.price”的外部URL。请查看演示站点以查看当前编码的url和重定向问题。首先,建议使用Vue方法处理表单验证和提交。其次,您应该避免在Vue组件中使用本机JavaScript事件处理程序,因为您使用的是Vue加载程序。在这里阅读更多
form.addEventListener('submit', e => {
    e.preventDefault()
    showLoadingIndicator()
    fetch(scriptURL, { method: 'POST', body: new FormData(form) })
        .then(response => showSuccessMessage(response))
        .catch(error => showErrorMessage(error))
})

function showSuccessMessage(response) {
    console.log('Success!', response)
    setTimeout(() => {
        successMessage.classList.remove('is-hidden')
        loading.classList.add('is-hidden')
    }, 500)
}
<script type="text/javascript">
  const app = new Vue({
    el: '#app',
    data: {
      items: []
    },
    created: function () {
      fetch('listorder.json')
        .then(resp => resp.json())
        .then(items => {
          this.items = items;
        })
    },
    methods: {
      redirect: function () {
        window.location.href = "https://www.paypal.me/wereallcatshere/USD" + item.price;
      }
    }
  });