如何用Vue动态构建长尾关键词URL?

2026-04-03 00:131阅读0评论SEO问题
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计362个文字,预计阅读时间需要2分钟。

如何用Vue动态构建长尾关键词URL?

如何通过变量动态拼接URL?

格式:a :href=#index.?other=' + object.name rel=external nofollow />

这是一个动态链接。需要注意的点是,href前面需要加上冒号,href最外层是双引号,中间是单引号。

如何用Vue动态构建长尾关键词URL?

如何通过变量动态拼接url?

格式:<a :href="'index.shtml?other='+object.name" rel="external nofollow" rel="external nofollow" >这是一个动态链接</a>

需要注意的是href前要加上冒号,href最外层是双引号,中间是单引号。

<div class="tab-content" id="datatable"> <div v-for="(object,index) in items"> <!-格式如下,href前要加上冒号---> <a :href="'index.shtml?other='+object.name" rel="external nofollow" rel="external nofollow" >这是一个动态链接</a> </div> </div> <script> $(document).ready(function() { App.init(); //数据列表 var datatable = new Vue({ el: '#datatable', data: { items: [], }, }); //从服务端获取数据 getList(); function getList() { $.ajax({ url : "/sapi/getcluster", type : "post", dataType : "json", success : function(result){ if(result.status == -1){ window.location.href = result.data; return false; } datatable.items = result.data["XXX"]; } }); } }); </script>

动态拼接结果为:

href=“index.shtml?other=yyy”

补充知识:vue全局变量apiurl

1、定义

在main.js里面定义

Vue.prototype.$apiUrl = " xxxxxxxxxx";

2、使用

在联调的时候

url: this.$apiUrl + "/xxxx(端口)"

以上这篇使用vue实现通过变量动态拼接url就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持易盾网络。

本文共计362个文字,预计阅读时间需要2分钟。

如何用Vue动态构建长尾关键词URL?

如何通过变量动态拼接URL?

格式:a :href=#index.?other=' + object.name rel=external nofollow />

这是一个动态链接。需要注意的点是,href前面需要加上冒号,href最外层是双引号,中间是单引号。

如何用Vue动态构建长尾关键词URL?

如何通过变量动态拼接url?

格式:<a :href="'index.shtml?other='+object.name" rel="external nofollow" rel="external nofollow" >这是一个动态链接</a>

需要注意的是href前要加上冒号,href最外层是双引号,中间是单引号。

<div class="tab-content" id="datatable"> <div v-for="(object,index) in items"> <!-格式如下,href前要加上冒号---> <a :href="'index.shtml?other='+object.name" rel="external nofollow" rel="external nofollow" >这是一个动态链接</a> </div> </div> <script> $(document).ready(function() { App.init(); //数据列表 var datatable = new Vue({ el: '#datatable', data: { items: [], }, }); //从服务端获取数据 getList(); function getList() { $.ajax({ url : "/sapi/getcluster", type : "post", dataType : "json", success : function(result){ if(result.status == -1){ window.location.href = result.data; return false; } datatable.items = result.data["XXX"]; } }); } }); </script>

动态拼接结果为:

href=“index.shtml?other=yyy”

补充知识:vue全局变量apiurl

1、定义

在main.js里面定义

Vue.prototype.$apiUrl = " xxxxxxxxxx";

2、使用

在联调的时候

url: this.$apiUrl + "/xxxx(端口)"

以上这篇使用vue实现通过变量动态拼接url就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持易盾网络。