如何在不使数据模型成为函数的情况下将标识符绑定到 url
How do i bind the identifer to the url without making the data model a function
我一直在尝试将超链接绑定到我的项目,但我不想让我的模型成为一个函数。我只是想绑定标识符,以便在单击时将转到正确的 url。任何见解都会很棒!
new Vue({
el: "#app",
data: {
generatedData: "Identifier": "1002", "Name": "some name",
]
},
methods: {
toggle: function(todo){
todo.done = !todo.done
}
}
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div id="app">
<p v-if="generatedData">The site location is here:
<a v-if="generatedData" href="https://yahoo.com/home/{{generatedData.Identifier}}">https://yahoo.com/home/{{generatedData.Identifier}}</a></p>
</div>
如果我理解正确的话:
new Vue({
el: "#app",
data() {
return {
generatedData: {"Identifier": "1002", "Name": "some name"},
}
},
methods: {
toggle: function(todo){
todo.done = !todo.done
}
}
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div id="app">
<p v-if="generatedData">The site location is here:
<a v-if="generatedData" :href="'https://yahoo.com/home/'+generatedData.Identifier">
https://yahoo.com/home/{{generatedData.Identifier}}
</a>
</p>
</div>
我一直在尝试将超链接绑定到我的项目,但我不想让我的模型成为一个函数。我只是想绑定标识符,以便在单击时将转到正确的 url。任何见解都会很棒!
new Vue({
el: "#app",
data: {
generatedData: "Identifier": "1002", "Name": "some name",
]
},
methods: {
toggle: function(todo){
todo.done = !todo.done
}
}
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div id="app">
<p v-if="generatedData">The site location is here:
<a v-if="generatedData" href="https://yahoo.com/home/{{generatedData.Identifier}}">https://yahoo.com/home/{{generatedData.Identifier}}</a></p>
</div>
如果我理解正确的话:
new Vue({
el: "#app",
data() {
return {
generatedData: {"Identifier": "1002", "Name": "some name"},
}
},
methods: {
toggle: function(todo){
todo.done = !todo.done
}
}
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div id="app">
<p v-if="generatedData">The site location is here:
<a v-if="generatedData" :href="'https://yahoo.com/home/'+generatedData.Identifier">
https://yahoo.com/home/{{generatedData.Identifier}}
</a>
</p>
</div>