vue3 脚手架初始化项目生成文件的介绍

在这里插入图片描述

文章目录

  • 一、介绍
  • 二、举例说明
    • 1.src/http/index.js
    • 2.src/router/index.js
    • 3.src/router/routes.js
    • 4.src/stores/index.js
    • 5.src/App.vue
    • 6.src/main.js
    • 7.babel.config.js
    • 8.jsconfig.json
    • 9.vue.config.js
    • 10. .env
    • 11.src/mock/index.js
    • 12.src/mock/mock-i18n.js
    • 13.src/locales/en.json
    • 14.src/locales/zh.json
    • 15.src/locales/index.js
    • 16.src/views/pages/system/system.js
    • 17. .gitignore
    • 18.package.json

一、介绍

  • node_modules文件夹:项目依赖文件夹
  • public文件夹:一般放置一些静态资源(图片),需要注意,放在public文件夹中的静态资源,在webpack打包时,会原封不动的打包到dist文件夹中。
  • src文件夹(程序员源代码文件夹):
    • assets文件夹:一般也是放置静态资源(一般放置多个组件共用的静态资源),需要注意,放在assets文件夹里的静态资源,在webpack打包时,会把此静态资源当作一个模块,打包到JS文件中。
    • components文件夹:一般放置非路由组件(全局组件)。
    • http文件夹:
      • index.js:集中管理 HTTP 请求的配置和处理逻辑,使得在应用中发送 HTTP 请求变得更加简单和一致。通过使用 Axios 实例和拦截器,可以有效地管理请求和响应,处理身份验证和错误情况,确保用户体验的流畅性。
    • App.vue文件:唯一的根组件。
    • main.js文件:程序的入口文件,也是整个程序当中最先执行的文件。
    • pages|views文件夹:路由组件。
    • router文件夹:路由相关配置。
      • index.js:配置路由
      • routes.js:路由规则定义(该文件夹可有可无,可全部放在上面index.js中)
    • store文件夹:
      • index.js:vuex相关配置。
    • utils文件夹:该文件夹里面经常放一些常用的功能模块,比如正则、临时身份UUID等等。
    • locales:
      • en.json:英文词条
      • zh.json:中文词条
      • index.js:国际化相关配置
    • mock文件夹:模拟json文件及相关接口调用
      • index.js:是一个用于模拟 API 响应的模块,通常在前端开发中使用。它利用 mockjs 库来创建虚拟的 API 接口,以便在开发和测试过程中不依赖于后端服务。以下是这个文件的主要功能和组成部分。
      • mock-i18n.js:模拟的词条文件。
  • babel.config.js文件:babel配置文件(bable相关)。
  • package.json文件:相当于项目的“身份证”,记录了项目的相关信息(如名字、依赖、运行方式等等)。
  • package-lock.json文件:又叫“缓存性文件”,跟踪被安装的每个软件包的确切版本,以便产品可以以相同的方式被 100% 复制(即使软件包的维护者更新了软件包)。即为什么刚开始启动慢,而后面启动就很快?因为缓存性文件都记录下来相关信息了,所以后续启动很快。
  • README.md文件:项目的说明性文件
  • vue.config.js文件:用于关闭ESLINT校验工具+配置代理服务器解决跨域
  • jsconfig.json文件:给src文件夹简写方法,配置别名,方便引入资源

在这里插入图片描述
在这里插入图片描述

二、举例说明

1.src/http/index.js

/*** @Name:* @Author:贾志博* @description:*/
import axios, { AxiosInstance, AxiosResponse } from "axios";
import {useStore} from "@/stores";// 创建http请求的实例对象
const $http = axios.create({timeout: 30000,withCredentials: false,headers: {'Content-Type': 'application/json;charset=UTF-8','Access-Control-Allow-Origin': '*','X-Requested-With': 'XMLHttpRequest'}
});// 添加请求拦截器
// $http.interceptors.request.use((config) => {
//   const token = ''
//   if (token) {
//     config.headers.Authorization = token;
//   }
//   return config;
// }, (error) => {
//   return Promise.reject(error)
// });// 添加响应拦截器
$http.interceptors.response.use(response=> {const { data } = responseif (response.status === 200) {return data}},error => {if (error.status === 401) {sessionStorage.removeItem('principal');localStorage.removeItem('mldn-session-id')// 路由跳转到登录界面window.location.href = `${window.location.origin}/#/`} else if (error.status == 502) {sessionStorage.removeItem('principal');localStorage.removeItem('mldn-session-id')window.location.href = `${window.location.origin}/#/`}return Promise.resolve({code: error.status})}
);const Method = {GET: 'get',POST: 'post',DELETE: 'delete',PUT: 'put',
}export { $http,  Method };

2.src/router/index.js

import { createRouter, createWebHashHistory } from 'vue-router'
import { baseRoutes, routes } from "./routes";
import { useStore } from "@/stores";
import {queryUserMenu} from "@/views/pages/system/system";
import { commonResponse } from "@/views/pages/_common";
import { getSystemType } from "@/views/login/_request";const router = createRouter({history: createWebHashHistory(process.env.BASE_URL),routes: baseRoutes
})
let permissionRoutes = []
let permissionMap = new Map()router.beforeEach((to, from, next) => {var principal = localStorage.getItem('mldn-session-id');var session_prncipal = sessionStorage.getItem('principal');const userName = localStorage.getItem("xnms-user-name");if (session_prncipal == null && principal == null) {principal = null;}if (principal == null) {if (to.name === 'login') {useStore().hasAuth = false;next()} else {useStore().hasAuth = false;next({name: 'login'})}} else if (to.name === 'login') {if(permissionRoutes.length > 0) {const initRouterPush = "/pages/" + permissionRoutes[0].path + "/" + permissionRoutes[0].children[0].path;useStore().setSelectedMenuKeyFunction(permissionRoutes[0].path)useStore().setSelectedMenuItemKeyFunction([permissionRoutes[0].path + "_" + permissionRoutes[0].children[0].path]);useStore().setOpenMenuItemFunction([permissionRoutes[0].path]);next({path: initRouterPush, replace: true});} else {hasAuthHandle(to, next, userName);}} else {hasAuthHandle(to, next, userName);}
});const hasAuthHandle = (to, next, userName) => {if(!useStore().hasAuth) {getSystemType().then(resp => {localStorage.setItem('system-type', resp.data)useStore().setMode(resp.data)queryUserMenu(userName).then(response => {commonResponse({response,onSuccess: () => {permissionRoutes = []permissionMap = new Map()try {const deepRoutes =  JSON.parse(JSON.stringify(routes));fillPermissionMap(permissionMap, response)permissionRoutes = handleRoutes(deepRoutes, permissionMap)if (permissionRoutes.length > 0) {useStore().routes.value = permissionRoutespermissionRoutes.forEach(item => {router.addRoute('pages', item)})}} catch (error) {console.error("Error during deep copy:", error);}useStore().hasAuth = true// 检查 to 是否在动态加载的路由里const isRouteExists = permissionRoutes.some(route => {if (route.name === to.name || route.path === to.path) {return true;}if (route.children) {return route.children.some(childRoute => {return childRoute.name === to.name || childRoute.path === to.path;});}return false;});if (isRouteExists) {next({...to, replace: true})} else {// 如果 to 不在动态路由里,可以导航到默认页面if (permissionRoutes.length > 0) {const initRouterPush = "/pages/" + permissionRoutes[0].path + "/" + permissionRoutes[0].children[0].path;useStore().setSelectedMenuKeyFunction(permissionRoutes[0].path)useStore().setSelectedMenuItemKeyFunction([permissionRoutes[0].path + "_" + permissionRoutes[0].children[0].path]);useStore().setOpenMenuItemFunction([permissionRoutes[0].path]);next({path: initRouterPush, replace: true});}}}})})})} else {next()}
}const fillPermissionMap = (permissionMap, response) => {const userName = localStorage.getItem('xnms-user-name')if (userName == "Admin") {response.data?.forEach(item => {const { code, canLook, canEdit } = item;permissionMap.set(code, {view: canLook == true ? 1 : 0,edit: canEdit == true ? 1 : 0})})} else {response.data?.forEach(item => {const { code, canLook, canEdit } = item;if (code.length === 4) {permissionMap.set(code, {view: canLook == true ? 1 : 0,edit: canEdit == true ? 1 : 0})}})response.data?.forEach(item => {const { code} = item;if (code.length === 2) {const children = response.data.filter(child => child.pid === code);const hasViewVisibleChild = children.some(child => child.canLook === 1);const hasEditVisibleChild = children.some(child => child.canEdit === 1);permissionMap.set(code, {view: hasViewVisibleChild ? 1 : 0,edit: hasEditVisibleChild ? 1 : 0});}})}
}const handleRoutes = (routes, permissionMap) => {for (let i = 0; i < routes.length; i++) {const item = routes[i]if (permissionMap?.get(routes[i].meta.key)?.view) {routes[i].meta.edit = permissionMap?.get(routes[i].meta.key)?.editif (item.children?.length) {handleRoutes(item.children, permissionMap)} else {if (!item.component) {let fileExistCommon = truelet pathStr = ''try {const path = item.name.split('_')pathStr = path.reduce((pre, cur, index) => {return `${pre}/${index === path.length - 1 ? cur.charAt(0).toUpperCase() + cur.slice(1) : cur}`})require(`@/views/pages/${pathStr}.vue`)} catch (e) {fileExistCommon = false}let fileExistDiff = trueconst modeName = useStore().getMode() ? 'XPT' : 'NOR'try {require(`@/views/pages/${pathStr}-${modeName}.vue`)} catch (e) {fileExistDiff = false}if (fileExistDiff) {item.component = () => import(`@/views/pages/${pathStr}-${modeName}.vue`)} else if (fileExistCommon) {item.component = () => import(`@/views/pages/${pathStr}.vue`)} else {item.component = () => import('@/views/pages/_error/404.vue')}}}} else {routes.splice(i, 1)i--}}return routes
}export default router

3.src/router/routes.js

import Login from "@/views/login/index.vue";
import Index from "@/views/pages/index.vue";export const baseRoutes = [{path: '/',name: 'login',component: Login,},{path: '/pages',name: 'pages',component: Index,children: []}
]export const routes = [{path: 'topology',name: 'topology',meta: {key: '00'},children: [{path: 'topologyView',name: 'topology_topologyView',breadcrumb: 'menu_topoView',meta: {key: '0000'},},{path: 'electronicMap',name: 'topology_electronicMap',breadcrumb: 'menu_electronicMap',meta: {key: '0001'},},]}
]

4.src/stores/index.js

import {defineStore} from "pinia";
import {ref} from 'vue'export const useStore = defineStore('main', () => {const mode = ref(0)const setMode = (modeVal) => {mode.value = modeVal}const getMode = () => {return mode.value}const openMenuItem = ref([]);const setOpenMenuItemFunction = (modeVal) => {openMenuItem.value = modeVal}const getOpenMenuItemFunction = () => {return openMenuItem}const selectedMenuItemKey = ref(null);const setSelectedMenuItemKeyFunction = (modeVal) => {selectedMenuItemKey.value = modeVal}const getSelectedMenuItemKeyFunction = () => {return selectedMenuItemKey}const selectedMenuKey = ref("");const setSelectedMenuKeyFunction = (modeVal) => {selectedMenuKey.value = modeVal}const getSelectedMenuKeyFunction = () => {return selectedMenuKey}const hasAuth = ref(false)const routes = ref([])const popoverVisible = ref(false);const popoverPosition = ref({ top: 0, left: 0 });const selectTopoNode = ref(null)const websocketRepeaterList = ref([])return {getMode,setMode,setSelectedMenuKeyFunction,getSelectedMenuKeyFunction,setSelectedMenuItemKeyFunction,getSelectedMenuItemKeyFunction,setOpenMenuItemFunction,getOpenMenuItemFunction,hasAuth,routes,popoverVisible,popoverPosition,selectTopoNode,websocketRepeaterList,}
})

使用方式:在其他xx.vue页面中

import { useStore } from "@/stores";useStore().hasAuth = false;

5.src/App.vue

<template><router-view/>
</template><script setup>
import {reactive, provide} from "vue";
import {useI18n} from "vue-i18n";
import {useStore} from "@/stores";
import {getSystemLanguage} from "@/views/pages/system/system";
const userInfo = reactive({userId: '',token: ''
})
provide('t', useI18n().t)
provide('userInfo', userInfo)const getSystemMode = () => {getSystemLanguage().then(response => {const mode = response.dataif (mode) {localStorage.setItem('xnms-mode', mode)useStore().setMode(parseInt(mode))}})
}getSystemMode()
</script><style>
</style>

6.src/main.js

import { createApp } from 'vue';
import App from './App.vue';
import { createPinia } from "pinia";
// import getRouter from '@/router';
import router from '@/router'
import getI18n from '@/locales';
import SelfComponents from "@/views/pages/_common/selfComponents/index";
import ArcoVue, {Message} from '@arco-design/web-vue';
import ArcoVueIcon from '@arco-design/web-vue/es/icon';
import '@arco-design/web-vue/dist/arco.css';
import '@/assets/index.less';
window.Message = Message
if (process.env.NODE_ENV === 'development') {// import('@/mock')
}const store = createPinia()const promise = Promise.all([getI18n()])
const _beforeMount = await promise
// window.i18n = _beforeMount[0]const app = createApp(App)
app.use(_beforeMount[0]).use(router).use(ArcoVue).use(ArcoVueIcon).use(store).use(SelfComponents)
app.mount('#app')

7.babel.config.js

module.exports = {presets: ['@vue/cli-plugin-babel/preset']
}

8.jsconfig.json

{"compilerOptions": {"target": "es5","module": "esnext","baseUrl": "./","moduleResolution": "node","paths": {"@/*": ["src/*"]},"lib": ["esnext","dom","dom.iterable","scripthost"]}
}

9.vue.config.js

const { defineConfig } = require('@vue/cli-service')
const path = require('path')
// const target = 'http://127.0.0.1:61000/'
// const target = 'http://10.110.24.117:62000/'
const target = 'http://10.110.24.62:61000/'
module.exports = defineConfig({// publicPath: process.env.NODE_ENV === 'development' ? '' : '/XNMS',transpileDependencies: true,lintOnSave: false,assetsDir: 'assets',devServer: {proxy: {'/api': {target,changeOrigin: true,},}},pluginOptions: {i18n: {locale: 'en',fallbackLocale: 'en',localeDir: 'locales',enableLegacy: false,runtimeOnly: false,compositionOnly: false,fullInstall: true}},chainWebpack: config => {config.module.rule('svg').exclude.add(path.resolve('src/assets/svg'))config.module.rule('icons').test(/\.svg$/).include.add(path.resolve('src/assets/svg')).end().use('svg-sprite-loader').loader('svg-sprite-loader').options({ symbolId: 'icon-[name]' })}
})

10. .env

VUE_APP_I18N_LOCALE=en
VUE_APP_I18N_FALLBACK_LOCALE=en

11.src/mock/index.js

import Mock from 'mockjs'
import {i18nList} from './mock-i18n'Mock.mock('/menu/list', 'get', {status: 0,dataList: [{path: 'topology',children: [{path: 'topologyView',name: 'topology_topologyView',},{path: 'electronicMap',name: 'topology_electronicMap',},]}]
})Mock.mock('/api/in', 'get', {code: 200,data: 1,msg: "成功",pagination: null
})Mock.mock(/^\/api\/in\/[\S]*$/, 'get', {code: 200,msg: '',data: {...i18nList()}
})Mock.mock('/api/site_statistic', 'post', {"code": 200,"data": [{"businessData": {"datas": {"additionalProp1": 1,"additionalProp2": 2,"additionalProp3": 3,"additionalProp4": 4,"additionalProp5": 5},},"siteData": {"datas": {"additionalProp1": 1,"additionalProp2": 2,"additionalProp3": 3,"additionalProp4": 4,"additionalProp5": 5},},"siteID": 1,"siteAlias": "站点1",},{"businessData": {"datas": {"additionalProp1": 1,"additionalProp2": 2,"additionalProp3": 3,"additionalProp4": 4,"additionalProp5": 5},},"siteData": {"datas": {"additionalProp1": 1,"additionalProp2": 2,"additionalProp3": 3,"additionalProp4": 4,"additionalProp5": 5},},"siteID": 2,"siteAlias": "站点2",}],"msg": "string","pagination": {"currentPage": 0,"pageSize": 0,"totalPages": 0,"totalRecords": 0}
})Mock.mock('/api/getTransferBusinessData', 'post', {code: 200,data: [{id: '1',name: '站点1',byDateLine: [{date: '2021-01-01',value1: 1,value2: 2}, {date: '2021-01-02',value1: 3,value2: 4}, {date: '2021-01-04',value1: 3,value2: 6}],byBusinessTimePie: {1: 2,2: 4,3: 6,4: 1,5: 3},byTimeLine: [{date: '2021-01-01',value1: 1,value2: 2}, {date: '2021-01-02',value1: 3,value2: 4}, {date: '2021-01-04',value1: 3,value2: 6}],},{id: '2',name: '站点2',byDateLine: [{date: '2021-01-01',value1: 1,value2: 2}, {date: '2021-01-02',value1: 3,value2: 4}, {date: '2021-01-04',],}]
})

12.src/mock/mock-i18n.js

export const i18nList = () => {return {"Title": "XNMS客户端","XPTTitle": "XNMS","Login": "登  录","LoginCancel": "取消登录","LoginCheckPassword": "验证中…",}
}

13.src/locales/en.json

{"menu_topology": "Topology View","menu_alarm": "Monitoring Alarm","menu_device": "Equipment Parameters","menu_data": "Data Query","menu_business": "Business Statistics",
}

14.src/locales/zh.json

{"menu_topology": "拓扑展示","menu_alarm": "监控告警","menu_device": "设备参数","menu_data": "数据查询","menu_business": "业务统计",
}

15.src/locales/index.js

import { createI18n } from 'vue-i18n'
import {getI18nLanguagePkg, getNowLanguageType} from "@/views/login/_request";const getNowLanguage = async () => {return new Promise((resolve, reject) => {getNowLanguageType().then(response => {if (response.code === 200) {resolve(response.data)} else {window.Message.warning(response.msg)}})})
}const loadRemoteMessages = async (language) => {return new Promise((resolve, reject) => {getI18nLanguagePkg(language).then(response => {if (response.code === 200) {const messages = {}messages[languageEnum[language]] = response.dataresolve(messages)} else {window.Message.warning(response.msg)}})})
}const getI18n = async () => {const language = await getNowLanguage()localStorage.setItem('xnms-language', language)const remoteMessages = await loadRemoteMessages(language)const i18n = createI18n({legacy: false,locale: languageEnum[language],fallbackLocale: 'zh',messages: remoteMessages,globalInjection: true})return new Promise((resolve) => {resolve(i18n)})
}const languageEnum = {0: 'en',1: 'zh',2: 'ru'
}export default getI18n

16.src/views/pages/system/system.js

import { $http, Method } from "@/http";export const getDeviceManageList = (data) => {return $http({url: `/api/deviceManage/queryDeviceList`,method: Method.POST,data})
}export const getSystemLanguage = (data) => {return $http({url: `/api/config`,method: Method.GET,data})
}export const deleteDevice = (data) => {return $http({url: `/api/deviceManage/deleteRepeater`,method: Method.DELETE,data})
}export const updateDevive = (data) => {return $http({url: `/api/deviceManage/updateDeviceSnmpV3`,method: Method.PUT,data})
}

17. .gitignore

.DS_Store
node_modules
/dist# local env files
.env.local
.env.*.local# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

18.package.json

{"name": "xnms","version": "0.1.0","private": true,"scripts": {"serve": "vue-cli-service serve","build": "vue-cli-service build","lint": "vue-cli-service lint","i18n:report": "vue-cli-service i18n:report --src \"./src/**/*.?(js|vue)\" --locales \"./src/locales/**/*.json\""},"dependencies": {"axios": "^1.7.7","core-js": "^3.8.3","echarts": "^5.5.1","html2canvas": "^1.4.1","jspdf": "^3.0.0","leaflet": "^1.9.4","leaflet-polylinedecorator": "^1.6.0","less": "^4.2.0","less-loader": "^12.2.0","mockjs": "^1.1.0","moment": "^2.30.1","pinia": "^2.2.2","svg-sprite-loader": "^6.0.11","vue": "^3.2.13","vue-i18n": "^9.1.0","vue-router": "^4.0.3"},"devDependencies": {"@arco-design/web-vue": "^2.56.2","@babel/core": "^7.12.16","@babel/eslint-parser": "^7.12.16","@intlify/vue-i18n-loader": "^3.0.0","@vue/cli-plugin-babel": "~5.0.0","@vue/cli-plugin-eslint": "~5.0.0","@vue/cli-plugin-router": "~5.0.0","@vue/cli-service": "~5.0.0","eslint": "^7.32.0","eslint-plugin-vue": "^8.0.3","vue-cli-plugin-i18n": "~2.3.2","vue-cli-plugin-mock": "~1.0.3"},"eslintConfig": {"root": true,"env": {"node": true},"extends": ["plugin:vue/vue3-essential","eslint:recommended"],"parserOptions": {"parser": "@babel/eslint-parser"},"rules": {}},"browserslist": ["> 1%","last 2 versions","not dead","not ie 11"]
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/web/74976.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

ubuntu 20.04 编译和运行A-LOAM

1.搭建文件目录和clone代码 mkdir -p A-LOAM/src cd A-LOAM/src git clone https://github.com/HKUST-Aerial-Robotics/A-LOAM cd .. 2.修改代码文件 2.1 由于PCL版本1.10&#xff0c;将CMakeLists.txt中的C标准改为14&#xff1a; set(CMAKE_CXX_FLAGS "-stdc14"…

【教程】MacBook 安装 VSCode 并连接远程服务器

目录 需求步骤问题处理 需求 在 Mac 上安装 VSCode&#xff0c;并连接跳板机和服务器。 步骤 Step1&#xff1a;从VSCode官网&#xff08;https://code.visualstudio.com/download&#xff09;下载安装包&#xff1a; Step2&#xff1a;下载完成之后&#xff0c;直接双击就能…

LabVIEW 长期项目开发

LabVIEW 凭借其图形化编程的独特优势&#xff0c;在工业自动化、测试测量等领域得到了广泛应用。对于长期运行、持续迭代的 LabVIEW 项目而言&#xff0c;其开发过程涵盖架构设计、代码管理、性能优化等多个关键环节&#xff0c;每个环节都对项目的成功起着至关重要的作用。下面…

用matlab搭建一个简单的图像分类网络

文章目录 1、数据集准备2、网络搭建3、训练网络4、测试神经网络5、进行预测6、完整代码 1、数据集准备 首先准备一个包含十个数字文件夹的DigitsData&#xff0c;每个数字文件夹里包含1000张对应这个数字的图片&#xff0c;图片的尺寸都是 28281 像素的&#xff0c;如下图所示…

Go 语言语法精讲:从 Java 开发者的视角全面掌握

《Go 语言语法精讲&#xff1a;从 Java 开发者的视角全面掌握》 一、引言1.1 为什么选择 Go&#xff1f;1.2 适合 Java 开发者的原因1.3 本文目标 二、Go 语言环境搭建2.1 安装 Go2.2 推荐 IDE2.3 第一个 Go 程序 三、Go 语言基础语法3.1 变量与常量3.1.1 声明变量3.1.2 常量定…

如何选择优质的安全工具柜:材质、结构与功能的考量

在工业生产和实验室环境中&#xff0c;安全工具柜是必不可少的设备。它不仅承担着工具的存储任务&#xff0c;还直接影响工作环境的安全和效率。那么&#xff0c;如何选择一个优质的安全工具柜呢&#xff1f;关键在于对材质、结构和功能的考量。 01材质&#xff1a;耐用与防腐 …

系统与网络安全------Windows系统安全(11)

资料整理于网络资料、书本资料、AI&#xff0c;仅供个人学习参考。 制作U启动盘 U启动程序 下载制作U启程序 Ventoy是一个制作可启动U盘的开源工具&#xff0c;只需要把ISO等类型的文件拷贝到U盘里面就可以启动了 同时支持x86LegacyBIOS、x86_64UEFI模式。 支持Windows、L…

【5】搭建k8s集群系列(二进制部署)之安装master节点组件(kube-controller-manager)

注&#xff1a;承接专栏上一篇文章 一、创建配置文件 cat > /opt/kubernetes/cfg/kube-controller-manager.conf << EOF KUBE_CONTROLLER_MANAGER_OPTS"--logtostderrfalse \\ --v2 \\ --log-dir/opt/kubernetes/logs \\ --leader-electtrue \\ --kubeconfig/op…

C#里第一个WPF程序

WPF程序对界面进行优化,但是比WINFORMS的程序要复杂很多, 并且界面UI基本上不适合拖放,所以需要比较多的时间来布局界面, 产且需要开发人员编写更多的代码。 即使如此,在面对诱人的界面表现, 随着客户对界面的需求提高,还是需要采用这样的方式来实现。 界面的样式采…

createContext+useContext+useReducer组合管理React复杂状态

createContext、useContext 和 useReducer 的组合是 React 中管理全局状态的一种常见模式。这种模式非常适合在不引入第三方状态管理库&#xff08;如 Redux&#xff09;的情况下&#xff0c;管理复杂的全局状态。 以下是一个经典的例子&#xff0c;展示如何使用 createContex…

记一次常规的网络安全渗透测试

目录&#xff1a; 前言 互联网突破 第一层内网 第二层内网 总结 前言 上个月根据领导安排&#xff0c;需要到本市一家电视台进行网络安全评估测试。通过对内外网进行渗透测试&#xff0c;网络和安全设备的使用和部署情况&#xff0c;以及网络安全规章流程出具安全评估报告。本…

el-table,新增、复制数据后,之前的勾选状态丢失

需要考虑是否为 更新数据的方式不对 如果新增数据的方式是直接替换原数据数组&#xff0c;而不是通过正确的响应式数据更新方式&#xff08;如使用 Vue 的 this.$set 等方法 &#xff09;&#xff0c;也可能导致勾选状态丢失。 因为 Vue 依赖数据的响应式变化来准确更新视图和…

第15届蓝桥杯java-c组省赛真题

目录 一.拼正方形 1.题目 2.思路 3.代码 二.劲舞团 1.题目 2.思路 3.代码 三.数组诗意 1.题目 2.思路 3.代码 四.封闭图形个数 1.题目 2.思路 3.代码 五.吊坠 1.题目 六.商品库存管理 1.题目 2.思路 3.代码 七.挖矿 1.题目 2.思路 3.代码 八.回文字…

玄机-应急响应-入侵排查

靶机排查目标&#xff1a; 1.web目录存在木马&#xff0c;请找到木马的密码提交 查看/var/www/html。 使用find命令查找 find ./ -type f -name "*.php | xargs grep "eval("查看到1.php里面存在无条件一句话木马。 2.服务器疑似存在不死马&#xff0c;请找…

usbip学习记录

USB/IP: USB device sharing over IP make menuconfig配置&#xff1a; Device Drivers -> Staging drivers -> USB/IP support Device Drivers -> Staging drivers -> USB/IP support -> Host driver 如果还有作为客户端的需要&#xff0c;继续做以下配置&a…

爱普生高精度车规晶振助力激光雷达自动驾驶

在自动驾驶技术快速落地的今天&#xff0c;激光雷达作为车辆的“智慧之眼”&#xff0c;其测距精度与可靠性直接决定了自动驾驶系统的安全上限。而在这双“眼睛”的核心&#xff0c;爱普生&#xff08;EPSON&#xff09;的高精度车规晶振以卓越性能成为激光雷达实现毫米级感知的…

28--当路由器开始“宫斗“:设备控制面安全配置全解

当路由器开始"宫斗"&#xff1a;设备控制面安全配置全解 引言&#xff1a;路由器的"大脑保卫战" 如果把网络世界比作一座繁忙的城市&#xff0c;那么路由器就是路口执勤的交通警察。而控制面&#xff08;Control Plane&#xff09;就是警察的大脑&#xf…

58.基于springboot老人心理健康管理系统

目录 1.系统的受众说明 2.相关技术 2.1 B/S结构 2.2 MySQL数据库 3.系统分析 3.1可行性分析 3.1.1时间可行性 3.1.2 经济可行性 3.1.3 操作可行性 3.1.4 技术可行性 3.1.5 法律可行性 3.2系统流程分析 3.3系统功能需求分析 3.4 系统非功能需求分析 4.系统设计 …

去中心化固定利率协议

核心机制与分类 协议类型&#xff1a; 借贷协议&#xff08;如Yield、Notional&#xff09;&#xff1a;通过零息债券模型&#xff08;如fyDai、fCash&#xff09;锁定固定利率。 收益聚合器&#xff08;如Saffron、BarnBridge&#xff09;&#xff1a;通过风险分级或博弈论…

反射率均值与RCS均值的计算方法差异

1. 反射率均值&#xff08;Mean Reflectance&#xff09; 定义&#xff1a; 反射率是物体表面反射的电磁波能量与入射能量的“比例”&#xff0c;通常以百分比或小数表示。 反射率均值是对多个测量点反射率的算术平均&#xff0c;反映目标区域整体的平均反射特性。 特点&a…