1.0.0 • Published 1 year ago

ca-sitemap v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

Overview

  1. 根据vue源码路由配置生成网站地图树形结构数据
  2. 内置接口调用发送数据到服务器

Installation

npm install ca-sitemap

Setup

Usage with vue-router

// 以下代码放到项目执行一次即可
import { generateSitemapsTree } from 'ca-sitemap'
import { routes } from 'router config XXX'

const options = {

  baseURL: "https://example.com",
  hashMode: true,
  routes: routes,
  sysCode: "SYSCODE",
  host: "http://10.62.129.122:8088"
}
generateSitemapsTree(options)
// src/routes.js

export const routes = [
  {
    path: '/',
    name: 'index',
    component: Layout,
    meta: {
      title: '首页',
    },
    children: [
      {
        path: '/dashboard',
        name: 'dashboard',
        component: () => import('@/views/dashboard'),
        hideChildrenInMenu: true,
        meta: {
          title: '首页',
          // keepAlive: true,
          icon: 'home',
          breadcrumb: true, // 为true时面包屑不显示
        }
      },
      {
        path: '/work',
        name: 'work',
        component: () => import('@/views/system/workBench'),
        meta: { title: '工作台' }
      }
    ],
  },
]

Options

options: {

	// 末尾斜杠,true生成,false则会删除
	trailingSlash: false,

	// hash mode: `true` 
	// (default: `false`)
	hashMode: false,

	// 域名/ip:port
	baseURL: 'https://example.com',

  // 路由配置,必填
  routes: routes,

  // 系统编码,大写 保存sitemaps唯一的key,必填
  sysCode: "CEM",

  // 数据上传服务器,测试环境: http://10.62.129.122:8088, 生产环境: http://10.63.130.103:8088
  host: "http://10.62.129.122:8088"

}
1.0.0

1 year ago

0.4.0

2 years ago

0.3.0

2 years ago

0.2.0

2 years ago

0.1.0

2 years ago