[英]Don't see a div into a vue component
I have a vue component with a div and a button and into another div I have two components 我有一个带有div和一个按钮的vue组件,到另一个div中,我有两个组件
<script> export default { name: 'excursion-backend-component', methods:{ doRedirection: function () { window.location = APP_URL+"/excursiones/create"; } }, mounted() { console.log(APP_URL+"/excursiones/create"); console.log("aaaa"); } } </script>
<template> <div class="container"> <h3>Adicionar excursión</h3> <div style="text-align: right"> <a class="btn btn-primary" :href="doRedirection"><i class="fa fa-plus"></i> Adicionar</a> </div> <br> <div> <excursion-list-component></excursion-list-component> <excursion-add-component></excursion-add-component> </div> </div> </template>
But I don't see the button on the navigator. 但是我没有在导航器上看到该按钮。
What is wrong? 怎么了?
:href="" expecting string with url to navigation, but you using method. :href =“”期望使用带有用于导航的url的字符串,但是您使用的是方法。
Use @click instead :href, if you want to use method. 如果要使用方法,请使用@click代替:href。
<a @click="doRedirect">... </a>
Or, may be, move it to computed block 或者,可以将其移至计算块
computed: {
excursionesUrl () {
return APP_URL+"/excursiones/create";
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.