修改article路由
This commit is contained in:
parent
0e2b0a37da
commit
51e4c85019
@ -126,7 +126,7 @@ export const constantRoutes = [
|
|||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
path: '/public/article',
|
path: '/public/articles/article',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1422,7 +1422,7 @@ export default {
|
|||||||
if(row.contentType.includes('text')){
|
if(row.contentType.includes('text')){
|
||||||
// let routeData = this.$router.resolve({path: '/public/p',query: {mark: row.id}})
|
// let routeData = this.$router.resolve({path: '/public/p',query: {mark: row.id}})
|
||||||
// window.open(routeData.href, '_blank');
|
// window.open(routeData.href, '_blank');
|
||||||
this.$router.push(`/public/article?mark=${row.id}`)
|
this.$router.push(`/public/articles/article?mark=${row.id}`)
|
||||||
}else{
|
}else{
|
||||||
// 打开文件
|
// 打开文件
|
||||||
const fileIds = [row.id]
|
const fileIds = [row.id]
|
||||||
|
|||||||
@ -769,7 +769,7 @@
|
|||||||
if(row.contentType.includes('text')){
|
if(row.contentType.includes('text')){
|
||||||
// let routeData = this.$router.resolve({path: '/public/p',query: {mark: row.id}})
|
// let routeData = this.$router.resolve({path: '/public/p',query: {mark: row.id}})
|
||||||
// window.open(routeData.href, '_blank');
|
// window.open(routeData.href, '_blank');
|
||||||
this.$router.push(`/public/article?mark=${row.id}`)
|
this.$router.push(`/public/articles/article?mark=${row.id}`)
|
||||||
}else{
|
}else{
|
||||||
// 打开文件
|
// 打开文件
|
||||||
const fileIds = [row.id]
|
const fileIds = [row.id]
|
||||||
|
|||||||
@ -91,7 +91,9 @@
|
|||||||
a = a.splice(a.length/2,a.length)
|
a = a.splice(a.length/2,a.length)
|
||||||
for (let i = 0; i < a.length; i++) {
|
for (let i = 0; i < a.length; i++) {
|
||||||
a[i] = a[i].replace(/id="/g, 'href="#')
|
a[i] = a[i].replace(/id="/g, 'href="#')
|
||||||
if (a[i].indexOf('h2') != -1) {
|
if (a[i].indexOf('h1') === 1) {
|
||||||
|
a[i] = '<li first>' + a[i].replace(/<h1>|<\/h1>/g, '') + '</li>'
|
||||||
|
}else if (a[i].indexOf('h2') !== -1) {
|
||||||
a[i] = '<li class="pl">' + a[i].replace(/<h2>|<\/h2>/g, '') + '</li>'
|
a[i] = '<li class="pl">' + a[i].replace(/<h2>|<\/h2>/g, '') + '</li>'
|
||||||
} else {
|
} else {
|
||||||
a[i] = '<li>' + a[i].replace(/<h1>|<\/h1>/g, '') + '</li>'
|
a[i] = '<li>' + a[i].replace(/<h1>|<\/h1>/g, '') + '</li>'
|
||||||
@ -115,9 +117,15 @@
|
|||||||
|
|
||||||
let $root = $('html, body');
|
let $root = $('html, body');
|
||||||
$('.j-titleList li').on("click", function () {
|
$('.j-titleList li').on("click", function () {
|
||||||
|
console.log(typeof($(this).attr("first"))!=="undefined")
|
||||||
|
let top = 20
|
||||||
|
if (typeof($(this).attr("first"))!=="undefined") {
|
||||||
|
// 点击第一个目录
|
||||||
|
top = 50
|
||||||
|
}
|
||||||
$root.animate({
|
$root.animate({
|
||||||
scrollTop: $($.attr(this.querySelector("a"), 'href')).offset().top - 20
|
scrollTop: $($.attr(this.querySelector("a"), 'href')).offset().top - top
|
||||||
}, 400);
|
}, 400)
|
||||||
return false
|
return false
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -126,7 +134,7 @@
|
|||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
addCodeBtn();
|
addCodeBtn();
|
||||||
_this.isLoading = false
|
_this.isLoading = false
|
||||||
},100)
|
},150)
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user