CN118567745A - A Vue project configuration method, device, electronic device and storage medium - Google Patents

A Vue project configuration method, device, electronic device and storage medium Download PDF

Info

Publication number
CN118567745A
CN118567745A CN202410629312.2A CN202410629312A CN118567745A CN 118567745 A CN118567745 A CN 118567745A CN 202410629312 A CN202410629312 A CN 202410629312A CN 118567745 A CN118567745 A CN 118567745A
Authority
CN
China
Prior art keywords
environment
configuration file
file
configuration
vue project
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202410629312.2A
Other languages
Chinese (zh)
Inventor
马元朋
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Teamsun Technology Co ltd
Original Assignee
Beijing Teamsun Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Teamsun Technology Co ltd filed Critical Beijing Teamsun Technology Co ltd
Priority to CN202410629312.2A priority Critical patent/CN118567745A/en
Publication of CN118567745A publication Critical patent/CN118567745A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Prevention of errors by analysis, debugging or testing of software
    • G06F11/3698Environments for analysis, debugging or testing of software
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/76Adapting program code to run in a different environment; Porting
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Stored Programmes (AREA)

Abstract

The embodiment of the invention discloses a Vue project configuration method, a device, electronic equipment and a storage medium, wherein the method is applied to a Web front end and comprises the following steps: the method comprises the steps of obtaining and running a packing command carrying a Vue project execution environment identifier and then loading an obtained environment file; reading a Vue project execution environment variable in an environment file, and obtaining a configuration file under a corresponding environment; and replacing the environment configuration general file corresponding to the Vue project file with the acquired configuration file. The technical scheme provided by the embodiment of the invention is applicable to the scene of the multi-environment deployment of the Vue project, and can solve the problems of time consumption and inconvenience in the operation of the configuration of the Vue project in the prior art.

Description

一种Vue项目配置方法、装置、电子设备及存储介质A Vue project configuration method, device, electronic device and storage medium

技术领域Technical Field

本发明涉及计算机技术领域,尤其涉及一种Vue项目配置方法、装置、电子设备及存储介质。The present invention relates to the field of computer technology, and in particular to a Vue project configuration method, device, electronic device and storage medium.

背景技术Background Art

Vue是一个JavaScript框架,用于构建用户界面,它允许开发者使用一种声明式的、组件化的编程模型,以实现更高效、灵活和易于维护的Web应用程序。由于Vue开发效率高、易于上手且学习曲线较浅,越来越多的开发者选择使用它来开发Web应用程序。其中,所述Web应用程序称之为Vue项目,可使用命令行工具Vue-CLI(Vue Command LineInterface,Vue命令行界面)快速搭建和管理Vue项目。Vue is a JavaScript framework for building user interfaces. It allows developers to use a declarative, componentized programming model to achieve more efficient, flexible, and easy-to-maintain web applications. Due to its high development efficiency, ease of use, and low learning curve, more and more developers choose to use it to develop web applications. Among them, the web application is called a Vue project, and the command line tool Vue-CLI (Vue Command Line Interface) can be used to quickly build and manage Vue projects.

在Web前端开发过程中,Vue项目打包是一个非常重要的环节。通过打包,可以优化应用程序的性能,并保证应用程序的安全性和可靠性,同时也能够支持浏览器兼容性,适应不同的环境和用户需求。打包完成之后,Vue项目的源码会被压缩且文件被重命名,修改难度大,每次修改完成只能重新打包。为解决此问题,一般的做法是将相关配置信息(如域名、业务配置等)提取出来,以便在打包完成之后能够动态修改程序的配置。In the process of Web front-end development, Vue project packaging is a very important link. Through packaging, the performance of the application can be optimized, and the security and reliability of the application can be guaranteed. At the same time, it can also support browser compatibility and adapt to different environments and user needs. After packaging, the source code of the Vue project will be compressed and the files will be renamed, which makes it difficult to modify. Each modification can only be repackaged. To solve this problem, the general practice is to extract relevant configuration information (such as domain name, business configuration, etc.) so that the configuration of the program can be dynamically modified after packaging is completed.

然而,当Vue项目需要在不同环境(比如开发环境、测试环境和现场环境)中部署时,需要修改程序代码并重新打包,或者,在打包完成后手动修改大量配置文件,操作非常耗时且不方便。However, when a Vue project needs to be deployed in different environments (such as development environment, test environment, and field environment), it is necessary to modify the program code and repackage it, or manually modify a large number of configuration files after packaging is completed, which is very time-consuming and inconvenient.

发明内容Summary of the invention

有鉴于此,本发明实施例提供一种Vue项目配置方法、装置、电子设备及存储介质,以解决现有技术中Vue项目多环境部署时配置操作耗时且不方便的问题。In view of this, an embodiment of the present invention provides a Vue project configuration method, device, electronic device and storage medium to solve the problem in the prior art that configuration operations are time-consuming and inconvenient when Vue projects are deployed in multiple environments.

第一方面,本发明实施例提供一种Vue项目配置方法,应用于Web前端,该方法包括:In a first aspect, an embodiment of the present invention provides a Vue project configuration method, which is applied to a Web front end, and the method includes:

获取运行携带有Vue项目执行环境标识的打包命令后加载得到的环境文件;Get the environment file loaded after running the packaging command with the Vue project execution environment identifier;

读取环境文件中的Vue项目执行环境变量,获取对应环境下的配置文件;Read the Vue project execution environment variables in the environment file and obtain the configuration file in the corresponding environment;

将获取到的配置文件,替换Vue项目文件中对应的环境配置通用文件。The obtained configuration file will replace the corresponding environment configuration common file in the Vue project file.

进一步的,读取环境文件中的Vue项目执行环境变量,获取对应环境下的配置文件,包括:Furthermore, read the Vue project execution environment variables in the environment file to obtain the configuration files in the corresponding environment, including:

遍历Vue项目文件中的各环境配置通用文件:读取遍历到的环境配置通用文件名称;读取环境文件中的Vue项目执行环境变量;根据读取结果,获取对应环境下的配置文件。Traverse the common environment configuration files in the Vue project file: read the name of the traversed common environment configuration file; read the Vue project execution environment variables in the environment file; according to the reading result, obtain the configuration file in the corresponding environment.

进一步的,获取对应环境下的配置文件,包括:Furthermore, obtain the configuration files for the corresponding environment, including:

在本地查找对应环境下的配置文件;Find the configuration file for the corresponding environment locally;

如果查找成功,则:判断查找到的配置文件是否存在可修改方;如果存在可修改方,则从Web服务端获取对应环境下的配置文件,替换在本地查找到的配置文件;If the search is successful, then: determine whether the found configuration file has a modifiable side; if it does, obtain the configuration file in the corresponding environment from the Web server and replace the configuration file found locally;

如果查找失败,则从Web服务端获取对应环境下的配置文件。If the search fails, the configuration file for the corresponding environment is obtained from the Web server.

进一步的,判断查找到的配置文件是否存在可修改方,包括:Further, determining whether the found configuration file has a modifiable part includes:

识别查找到的配置文件包含的变量;Identify variables contained in the found configuration file;

根据识别结果,确定查找到的配置文件是否存在可修改方。Based on the identification result, determine whether the found configuration file has a modifiable part.

进一步的,获取对应环境下的配置文件,包括:Furthermore, obtain the configuration files for the corresponding environment, including:

判断Vue项目类型是否属于预设的目标Vue项目类型;Determine whether the Vue project type belongs to the preset target Vue project type;

如果属于,则从Web服务端获取对应环境下的配置文件;If yes, obtain the configuration file in the corresponding environment from the Web server;

如果不属于,则在本地查找对应环境下的配置文件。If it does not, search for the configuration file in the corresponding environment locally.

第二方面,本发明实施例提供一种Vue项目配置装置,应用于Web前端,该装置包括:In a second aspect, an embodiment of the present invention provides a Vue project configuration device, which is applied to a Web front end, and the device includes:

环境文件获取单元,用于获取运行携带有Vue项目执行环境标识的打包命令后加载得到的环境文件;An environment file acquisition unit, used to acquire an environment file loaded after running a packaging command carrying a Vue project execution environment identifier;

配置文件获取单元,用于读取环境文件中的Vue项目执行环境变量,获取对应环境下的配置文件;The configuration file acquisition unit is used to read the Vue project execution environment variables in the environment file and obtain the configuration file in the corresponding environment;

配置文件替换单元,用于将获取到的配置文件,替换Vue项目文件中对应的环境配置通用文件。The configuration file replacement unit is used to replace the corresponding environment configuration common file in the Vue project file with the acquired configuration file.

进一步的,配置文件获取单元用于读取环境文件中的Vue项目执行环境变量,获取对应环境下的配置文件,包括:Furthermore, the configuration file acquisition unit is used to read the Vue project execution environment variables in the environment file and obtain the configuration file in the corresponding environment, including:

遍历Vue项目文件中的各环境配置通用文件:读取遍历到的环境配置通用文件名称;读取环境文件中的Vue项目执行环境变量;根据读取结果,获取对应环境下的配置文件。Traverse the common environment configuration files in the Vue project file: read the name of the traversed common environment configuration file; read the Vue project execution environment variables in the environment file; according to the reading result, obtain the configuration file in the corresponding environment.

进一步的,配置文件获取单元用于获取对应环境下的配置文件,包括:Furthermore, the configuration file acquisition unit is used to acquire the configuration file in the corresponding environment, including:

在本地查找对应环境下的配置文件;Find the configuration file for the corresponding environment locally;

如果查找成功,则:判断查找到的配置文件是否存在可修改方;如果存在可修改方,则从Web服务端获取对应环境下的配置文件,替换在本地查找到的配置文件;If the search is successful, then: determine whether the found configuration file has a modifiable side; if it does, obtain the configuration file in the corresponding environment from the Web server and replace the configuration file found locally;

如果查找失败,则从Web服务端获取对应环境下的配置文件。If the search fails, the configuration file for the corresponding environment is obtained from the Web server.

进一步的,配置文件获取单元用于判断查找到的配置文件是否存在可修改方,包括:Furthermore, the configuration file acquisition unit is used to determine whether the found configuration file has a modifiable part, including:

识别查找到的配置文件包含的变量;Identify variables contained in the found configuration file;

根据识别结果,确定查找到的配置文件是否存在可修改方。Based on the identification result, determine whether the found configuration file has a modifiable part.

进一步的,配置文件获取单元用于获取对应环境下的配置文件,包括:Furthermore, the configuration file acquisition unit is used to acquire the configuration file in the corresponding environment, including:

判断Vue项目类型是否属于预设的目标Vue项目类型;Determine whether the Vue project type belongs to the preset target Vue project type;

如果属于,则从Web服务端获取对应环境下的配置文件;If yes, obtain the configuration file in the corresponding environment from the Web server;

如果不属于,则在本地查找对应环境下的配置文件。If it does not, search for the configuration file in the corresponding environment locally.

第三方面,本发明实施例提供一种电子设备,所述电子设备包括:壳体、处理器、存储器、电路板和电源电路,其中,电路板安置在壳体围成的空间内部,处理器和存储器设置在电路板上;电源电路,用于为上述电子设备的各个电路或器件供电;存储器用于存储可执行程序代码;处理器通过读取存储器中存储的可执行程序代码来运行与可执行程序代码对应的程序,用于执行前述第一方面所述的Vue项目配置方法。In a third aspect, an embodiment of the present invention provides an electronic device, comprising: a housing, a processor, a memory, a circuit board and a power supply circuit, wherein the circuit board is placed inside the space enclosed by the housing, and the processor and the memory are arranged on the circuit board; the power supply circuit is used to supply power to various circuits or devices of the above-mentioned electronic device; the memory is used to store executable program code; the processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory, so as to execute the Vue project configuration method described in the first aspect above.

第四方面,本发明的实施例还提供一种计算机可读存储介质,所述计算机可读存储介质存储有一个或者多个程序,所述一个或者多个程序可被一个或者多个中央处理器执行,以实现前述第一方面所述的Vue项目配置方法。In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more central processing units to implement the Vue project configuration method described in the first aspect above.

附图说明BRIEF DESCRIPTION OF THE DRAWINGS

为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其它的附图。In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

图1为本发明实施例一提供的一种Vue项目配置方法的流程图;FIG1 is a flow chart of a Vue project configuration method provided by Embodiment 1 of the present invention;

图2为本发明实施例二提供的一种Vue项目配置方法的流程图;FIG2 is a flow chart of a Vue project configuration method provided by Embodiment 2 of the present invention;

图3为本发明实施例三提供的一种Vue项目配置方法的流程图;FIG3 is a flow chart of a Vue project configuration method provided by Embodiment 3 of the present invention;

图4为本发明实施例四提供的一种Vue项目配置装置的结构示意图;FIG4 is a schematic diagram of the structure of a Vue project configuration device provided by Embodiment 4 of the present invention;

图5为本发明实施例提供的一种电子设备的结构示意图。FIG5 is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention.

具体实施方式DETAILED DESCRIPTION

下面结合附图对本发明实施例进行详细描述。The embodiments of the present invention are described in detail below with reference to the accompanying drawings.

应当明确,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其它实施例,都属于本发明保护的范围。It should be clear that the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

实施例一Embodiment 1

本实施例提供一种Vue项目配置方法,该方法可由Web前端上对应的Vue项目配置装置执行,适用于Vue项目多环境部署的场景。参见图1,该方法包括以下步骤101-103。This embodiment provides a Vue project configuration method, which can be executed by a corresponding Vue project configuration device on a Web front end, and is applicable to scenarios where a Vue project is deployed in multiple environments. Referring to FIG. 1 , the method includes the following steps 101-103.

步骤101、获取运行携带有Vue项目执行环境标识的打包命令后加载得到的环境文件。Step 101, obtain the environment file loaded after running the packaging command carrying the Vue project execution environment identifier.

本步骤中,打包命令中添加有Vue项目执行环境标识,其中Vue项目执行环境可以是开发环境、测试环境或现场环境等。运行打包命令后,会自动根据命令中的Vue项目执行环境标识加载对应的环境文件,通常环境文件存储在本地创建的Vue项目根目录下,文件可命名为.env.Vue项目执行环境标识。环境文件记录有Vue项目执行环境变量,Vue项目配置装置无法直接读取加载的环境文件名称,但可以通过访问环境文件中的变量获知Vue项目的执行环境。In this step, the Vue project execution environment identifier is added to the packaging command, where the Vue project execution environment can be a development environment, a test environment, or a field environment. After running the packaging command, the corresponding environment file will be automatically loaded according to the Vue project execution environment identifier in the command. Usually, the environment file is stored in the root directory of the Vue project created locally, and the file can be named .env.Vue project execution environment identifier. The environment file records the Vue project execution environment variables. The Vue project configuration device cannot directly read the name of the loaded environment file, but can obtain the execution environment of the Vue project by accessing the variables in the environment file.

步骤102、读取环境文件中的Vue项目执行环境变量,获取对应环境下的配置文件。Step 102: Read the Vue project execution environment variables in the environment file to obtain the configuration file in the corresponding environment.

具体实施时,可遍历Vue项目文件中的各环境配置通用文件:读取遍历到的环境配置通用文件名称;读取环境文件中的Vue项目执行环境变量;根据读取结果,获取对应环境下的配置文件。其中,Vue项目文件由开发人员预先编写好,用于Vue项目执行时使用,包括多个配置文件,这些配置文件包含了项目的各种设置,比如开发服务器的端口、代理配置、代码压缩选项等,且文件格式可以是json、html、css、js、图片等,其中一部分配置文件为环境配置通用文件,该部分配置文件属于通用的配置文件,可包含Vue项目中所有执行环境都共享的设置和选项。In specific implementation, the various environment configuration common files in the Vue project file can be traversed: read the name of the traversed environment configuration common file; read the Vue project execution environment variables in the environment file; and obtain the configuration file in the corresponding environment based on the reading result. Among them, the Vue project file is pre-written by the developer for use when the Vue project is executed, including multiple configuration files. These configuration files contain various settings for the project, such as the port of the development server, proxy configuration, code compression options, etc., and the file format can be json, html, css, js, pictures, etc., of which some configuration files are environment configuration common files. These configuration files are common configuration files and can contain settings and options shared by all execution environments in the Vue project.

示例性的,可针对Vue项目文件中的环境配置通用文件,将环境配置通用文件名称与Vue项目执行环境变量值合并在一起得到对应环境下的配置文件名称,而后基于得到的配置文件名称在本地查找或访问Web服务端获取对应环境下的配置文件。Exemplarily, for the environment configuration common file in the Vue project file, the environment configuration common file name and the Vue project execution environment variable value can be merged together to obtain the configuration file name in the corresponding environment, and then based on the obtained configuration file name, the configuration file in the corresponding environment is searched locally or accessed to the Web server.

步骤103、将获取到的配置文件,替换Vue项目文件中对应的环境配置通用文件。Step 103: Replace the corresponding environment configuration general file in the Vue project file with the acquired configuration file.

本实施例提供的技术方案,针对Web前端开发,旨在提高开发效率、灵活性和部署的准确性,其有益效果主要体现在以下几个方面:The technical solution provided in this embodiment is aimed at Web front-end development and aims to improve development efficiency, flexibility and deployment accuracy. Its beneficial effects are mainly reflected in the following aspects:

灵活性:通过获取打包命令中的执行环境标识,可以根据不同的执行环境加载对应的环境文件和配置文件,实现了项目在不同环境下的灵活配置;开发人员可以根据需要在不同的执行环境中使用不同的配置,满足各种场景的需求;Flexibility: By obtaining the execution environment identifier in the packaging command, the corresponding environment files and configuration files can be loaded according to different execution environments, realizing flexible configuration of the project in different environments; developers can use different configurations in different execution environments as needed to meet the needs of various scenarios;

维护性:将不同环境下的配置文件分离并替换通用文件,使得配置的维护更加清晰和简单;开发人员可以分别管理和维护各个环境的配置文件,避免了在通用文件中修改不同环境的配置的复杂性和潜在的错误;Maintainability: Separating the configuration files for different environments and replacing the common files makes configuration maintenance clearer and simpler; developers can manage and maintain the configuration files for each environment separately, avoiding the complexity and potential errors of modifying the configurations of different environments in common files;

安全性:通过将环境配置文件与项目文件分离,可以更好地保护敏感配置信息的安全性;敏感信息可以存储在环境文件中,并在构建过程中进行加载,避免了将敏感配置信息暴露在项目代码中的风险;Security: By separating environment configuration files from project files, the security of sensitive configuration information can be better protected; sensitive information can be stored in environment files and loaded during the build process, avoiding the risk of exposing sensitive configuration information in project code;

可扩展性:通过该方案,可以轻松地添加新的执行环境和对应的配置文件;如果需要在现有项目中添加新的环境,只需创建对应的环境文件和配置文件,并更新打包命令中的执行环境标识,即可实现新环境的配置;Scalability: This solution allows you to easily add new execution environments and corresponding configuration files. If you need to add a new environment to an existing project, you only need to create the corresponding environment file and configuration file, and update the execution environment identifier in the packaging command to configure the new environment.

一致性:通过将对应环境下的配置文件替换通用文件,保证每个环境的配置在构建过程中一致地应用到项目文件中;这可以避免不同环境下配置不一致导致的意外行为和错误,提高系统的稳定性和可靠性。Consistency: By replacing the common files with the configuration files in the corresponding environment, the configuration of each environment is consistently applied to the project files during the build process; this can avoid unexpected behaviors and errors caused by inconsistent configurations in different environments and improve the stability and reliability of the system.

实施例二Embodiment 2

本实施例以上述实施例一为基础,对“获取对应环境下的配置文件”的步骤作进一步优化,提供一种Vue项目配置方法,参见图2,该方法包括步骤201-步骤208。This embodiment is based on the above-mentioned embodiment 1, and further optimizes the step of "obtaining the configuration file under the corresponding environment" to provide a Vue project configuration method. Referring to FIG. 2 , the method includes steps 201 to 208.

步骤201、获取运行携带有Vue项目执行环境标识的打包命令后加载得到的环境文件。Step 201, obtain the environment file loaded after running the packaging command carrying the Vue project execution environment identifier.

步骤202、读取环境文件中的Vue项目执行环境变量。Step 202: Read the Vue project execution environment variables in the environment file.

步骤203、在本地查找对应环境下的配置文件。如果查找成功,则执行步骤204;如果查找失败,则执行步骤207。Step 203: Search the local computer for the configuration file in the corresponding environment. If the search succeeds, execute step 204; if the search fails, execute step 207.

步骤204、判断查找到的配置文件是否存在可修改方。如果是,则执行步骤205;如果否,则执行步骤206。Step 204: Determine whether the found configuration file has a modifiable side. If yes, execute step 205; if no, execute step 206.

本步骤中,可通过如下方式,判断查找到的配置文件是否存在可修改方:In this step, you can determine whether the found configuration file has a modifiable method by:

检查文件权限:查看配置文件的权限设置,若配置文件设置为只读权限,则判断不存在可修改方;Check file permissions: Check the permission settings of the configuration file. If the configuration file is set to read-only permission, it is determined that there is no modifiable party;

检查文件位置:查看配置文件是否位于不可修改的保护目录中,如果是,则判断不存在可修改方;Check the file location: Check whether the configuration file is located in a non-modifiable protected directory. If so, it is determined that there is no modifiable method.

验证文件完整性:使用文件校验和或数字签名等技术验证文件的完整性;如果配置文件的校验和/或数字签名不匹配,说明文件内容已被篡改,判断存在可修改方。Verify file integrity: Use technologies such as file checksum or digital signature to verify file integrity; if the checksum and/or digital signature of the configuration file do not match, it means that the file content has been tampered with and it is determined that there is a modifiable party.

优选的,可通过访问和分析文件内容,来判断查找到的配置文件是否存在可修改方。具体地,识别查找到的配置文件包含的变量;根据识别结果,确定查找到的配置文件是否存在可修改方。如果查找到的配置文件包含设定的可修改变量,则确定查找到的配置文件存在可修改方;否则,不存在可修改方。Preferably, it is possible to determine whether the found configuration file has a modifiable side by accessing and analyzing the file content. Specifically, the variables contained in the found configuration file are identified; and based on the identification result, it is determined whether the found configuration file has a modifiable side. If the found configuration file contains the set modifiable variables, it is determined that the found configuration file has a modifiable side; otherwise, it does not have a modifiable side.

步骤205、从Web服务端获取对应环境下的配置文件,替换在本地查找到的配置文件,执行步骤206。Step 205 , obtain the configuration file in the corresponding environment from the Web server, replace the configuration file found locally, and execute step 206 .

步骤206、将本地查找到的配置文件作为最终的对应环境下的配置文件。执行步骤208。Step 206: Use the locally found configuration file as the final configuration file for the corresponding environment. Execute step 208.

步骤207、从Web服务端获取对应环境下的配置文件。执行步骤208。Step 207: Obtain the configuration file in the corresponding environment from the Web server. Execute step 208.

步骤208、将获取到的配置文件,替换Vue项目文件中对应的环境配置通用文件。Step 208: Replace the corresponding environment configuration general file in the Vue project file with the acquired configuration file.

需要说明的是,本实施例中,可由Web服务端统一管理各个Vue项目在不同执行环境的配置文件。对于任意一个Vue项目,Web前端每访问Web服务端获取到此Vue项目的一种执行环境的配置文件后,可将其存储在本地或更新本地已有的此Vue项目的该种执行环境的配置文件。It should be noted that, in this embodiment, the Web server can uniformly manage the configuration files of various Vue projects in different execution environments. For any Vue project, after the Web front end accesses the Web server to obtain the configuration file of an execution environment of this Vue project, it can store it locally or update the existing configuration file of this execution environment of this Vue project locally.

本实施例提供的技术方案,具有如下优点:The technical solution provided in this embodiment has the following advantages:

优化资源利用与效率:仅当本地找不到配置文件或找到但可能被修改时,才从Web服务端获取配置,这种按需获取的方式减少了不必要的网络通信和存储占用,提高了系统资源的利用率和运行效率;Optimize resource utilization and efficiency: Only when the configuration file cannot be found locally or is found but may have been modified, the configuration is obtained from the Web server. This on-demand acquisition method reduces unnecessary network communication and storage usage, and improves system resource utilization and operating efficiency.

提高配置一致性:当本地查找到配置文件但文件存在可修改方的条件时,从Web服务端获取最新配置进行替换,确保了所有前端实例使用的配置与后台保持一致,避免了因配置不一致导致的错误和问题,增强了系统的稳定性;Improve configuration consistency: When a configuration file is found locally but the file has conditions that can be modified, the latest configuration is obtained from the Web server for replacement, ensuring that the configuration used by all front-end instances is consistent with the back-end, avoiding errors and problems caused by inconsistent configuration, and enhancing system stability;

增强安全性与可控性:集中管理配置文件于Web服务端,可以实施更严格的访问控制和审核流程,确保只有授权用户能修改配置,有效防止了配置信息的非法篡改,提升了系统的安全级别。Enhanced security and controllability: Centralized management of configuration files on the Web server can implement stricter access control and audit processes to ensure that only authorized users can modify the configuration, effectively preventing illegal tampering of configuration information and improving the security level of the system.

实施例三Embodiment 3

本实施例以上述实施例一为基础,对“获取对应环境下的配置文件”的步骤作进一步优化,提供一种Vue项目配置方法,参见图3,该方法包括步骤301-步骤307。This embodiment is based on the above-mentioned embodiment 1, and further optimizes the step of "obtaining the configuration file under the corresponding environment" to provide a Vue project configuration method. Referring to FIG. 3 , the method includes steps 301 to 307.

步骤301、获取运行携带有Vue项目执行环境标识的打包命令后加载得到的环境文件。Step 301, obtain the environment file loaded after running the packaging command carrying the Vue project execution environment identifier.

步骤302、读取环境文件中的Vue项目执行环境变量。Step 302: Read the Vue project execution environment variables in the environment file.

步骤303、判断Vue项目类型是否属于预设的目标Vue项目类型。如果是,则执行步骤304;如果否,则执行步骤305。Step 303: Determine whether the Vue project type belongs to the preset target Vue project type. If yes, execute step 304; if no, execute step 305.

在实际开发中,如果一个Vue项目在不同执行环境的配置文件数量庞大或者内容复杂,例如,包含复杂的业务逻辑配置、大量环境变量、数据库连接字符串、第三方服务凭证等,将这些配置文件直接集成到Web前端将显著增加Vue项目的体积,影响加载速度和性能,特别是在移动设备上,大的包体积极影响用户体验。此外,如果一个Vue项目在不同执行环境的配置文件中包含敏感信息,那么直接存储在Web前端会存在安全风险。In actual development, if a Vue project has a large number of configuration files in different execution environments or the content is complex, for example, it contains complex business logic configuration, a large number of environment variables, database connection strings, third-party service credentials, etc., integrating these configuration files directly into the Web front end will significantly increase the size of the Vue project, affecting the loading speed and performance, especially on mobile devices, where large packages have a positive impact on user experience. In addition, if a Vue project contains sensitive information in the configuration files of different execution environments, there will be security risks if it is directly stored in the Web front end.

针对以上情况,本实施例将上述两类Vue项目定义为目标Vue项目类型,并采取从Web服务端动态加载配置文件的策略。此策略避免直接将目标Vue项目部署在Web前端,转而寻求远程存储,由后台统一管理这两类Vue项目在各种执行环境的配置文件,不会占用Web前端大量资源,且能够保护敏感信息的安全性,提升用户体验。其中,目标Vue项目类型可由本领域技术人员预先设定完后配置在Web前端,或者由Web服务端确定完毕后下发给Web前端。In view of the above situation, this embodiment defines the above two types of Vue projects as target Vue project types, and adopts a strategy of dynamically loading configuration files from the Web server. This strategy avoids directly deploying the target Vue project on the Web front end, and instead seeks remote storage. The background uniformly manages the configuration files of these two types of Vue projects in various execution environments, which will not occupy a large amount of resources on the Web front end, and can protect the security of sensitive information and improve user experience. Among them, the target Vue project type can be pre-set by a technician in this field and then configured on the Web front end, or it can be determined by the Web server and then sent to the Web front end.

具体的,Web服务端确定目标Vue项目类型的步骤,可包括:Specifically, the steps for the Web server to determine the target Vue project type may include:

(1)确定第一目标Vue项目类型(1) Determine the first target Vue project type

评估Vue项目在不同执行环境的配置文件的总数量和复杂度;如果配置文件的总数量超过设定阈值,或者配置文件之间存在的依赖关系和逻辑关系达到设定的复杂度,则将该Vue项目类型确定为第一目标Vue项目类型;Evaluate the total number and complexity of configuration files of the Vue project in different execution environments; if the total number of configuration files exceeds a set threshold, or the dependencies and logical relationships between the configuration files reach a set complexity, determine the Vue project type as the first target Vue project type;

(2)确定第二目标Vue项目类型(2) Determine the second target Vue project type

建立敏感信息关键字列表,包括但不限于如下类型的关键字:数据库连接信息、API密钥、访问令牌、密码,例如:"password","key","secret","token","api_key","private_key","access_token","auth","credentials",等;Create a list of sensitive information keywords, including but not limited to the following keywords: database connection information, API keys, access tokens, passwords, such as "password", "key", "secret", "token", "api_key", "private_key", "access_token", "auth", "credentials", etc.;

通过自动化脚本、文本分析工具或正则表达式,扫描Vue项目在不同执行环境的配置文件名称,查找其中是否涉及敏感信息关键字列表中的关键字:Use automated scripts, text analysis tools, or regular expressions to scan the configuration file names of Vue projects in different execution environments to find out whether they contain keywords in the sensitive information keyword list:

如果是,则将该Vue项目类型确定为第二目标Vue项目类型;If yes, the Vue project type is determined as the second target Vue project type;

如果否,则扫描Vue项目在不同执行环境的配置文件内容,查找其中是否涉及敏感信息关键字列表中的关键字:如果是,则将该Vue项目类型确定为第二目标Vue项目类型,如果否,则确定该Vue项目类型不属于第二目标Vue项目类型。If not, scan the configuration file contents of the Vue project in different execution environments to find out whether they involve keywords in the sensitive information keyword list: if yes, determine the Vue project type as the second target Vue project type; if not, determine that the Vue project type does not belong to the second target Vue project type.

步骤304、从Web服务端获取对应环境下的配置文件。执行步骤306。Step 304: Obtain the configuration file in the corresponding environment from the Web server. Execute step 306.

步骤305、在本地查找对应环境下的配置文件。执行步骤306。Step 305: Search the local computer for the configuration file in the corresponding environment. Execute step 306.

步骤306、将获取到的配置文件,替换Vue项目文件中对应的环境配置通用文件。Step 306: Replace the corresponding environment configuration general file in the Vue project file with the acquired configuration file.

本实施例提供了一种灵活且自动化的配置文件管理流程。对于目标项目类型,可以从Web服务端动态获取配置文件,这样可以确保敏感信息不会在前端暴露,并且降低了Web前端的存储资源占用。对于非目标类型的项目,还支持本地查找配置,以满足快速开发和调试的需求。This embodiment provides a flexible and automated configuration file management process. For target project types, configuration files can be dynamically obtained from the Web server, which ensures that sensitive information is not exposed on the front end and reduces the storage resource usage of the Web front end. For non-target type projects, local search configuration is also supported to meet the needs of rapid development and debugging.

实施例四Embodiment 4

本实施例提供了一种Vue项目配置装置,由软件实现,用于执行本发明实施例所述的Vue项目配置方法。参见图4,该装置应用于Web前端,具体包括以下单元:This embodiment provides a Vue project configuration device, which is implemented by software and is used to execute the Vue project configuration method described in the embodiment of the present invention. Referring to FIG4 , the device is applied to a Web front end and specifically includes the following units:

环境文件获取单元401,用于获取运行携带有Vue项目执行环境标识的打包命令后加载得到的环境文件;An environment file acquisition unit 401 is used to acquire an environment file loaded after running a packaging command carrying a Vue project execution environment identifier;

配置文件获取单元402,用于读取环境文件中的Vue项目执行环境变量,获取对应环境下的配置文件;The configuration file acquisition unit 402 is used to read the Vue project execution environment variables in the environment file and obtain the configuration file under the corresponding environment;

配置文件替换单元403,用于将获取到的配置文件,替换Vue项目文件中对应的环境配置通用文件。The configuration file replacement unit 403 is used to replace the corresponding environment configuration general file in the Vue project file with the acquired configuration file.

示例性的,配置文件获取单元402用于读取环境文件中的Vue项目执行环境变量,获取对应环境下的配置文件,包括:Exemplarily, the configuration file acquisition unit 402 is used to read the Vue project execution environment variables in the environment file to obtain the configuration file in the corresponding environment, including:

遍历Vue项目文件中的各环境配置通用文件:读取遍历到的环境配置通用文件名称;读取环境文件中的Vue项目执行环境变量;根据读取结果,获取对应环境下的配置文件。Traverse the common environment configuration files in the Vue project file: read the name of the traversed common environment configuration file; read the Vue project execution environment variables in the environment file; according to the reading result, obtain the configuration file in the corresponding environment.

作为一种实施方式,配置文件获取单元402用于获取对应环境下的配置文件,包括:As an implementation manner, the configuration file acquisition unit 402 is used to acquire the configuration file in the corresponding environment, including:

在本地查找对应环境下的配置文件;Search the configuration file for the corresponding environment locally;

如果查找成功,则:判断查找到的配置文件是否存在可修改方;如果存在可修改方,则从Web服务端获取对应环境下的配置文件,替换在本地查找到的配置文件;If the search is successful, then: determine whether the found configuration file has a modifiable side; if it does, obtain the configuration file in the corresponding environment from the Web server and replace the configuration file found locally;

如果查找失败,则从Web服务端获取对应环境下的配置文件。If the search fails, the configuration file for the corresponding environment is obtained from the Web server.

示例性的,配置文件获取单元402用于判断查找到的配置文件是否存在可修改方,包括:Exemplarily, the configuration file acquisition unit 402 is used to determine whether the found configuration file has a modifiable part, including:

识别查找到的配置文件包含的变量;Identify the variables contained in the found configuration file;

根据识别结果,确定查找到的配置文件是否存在可修改方。Based on the identification result, determine whether the found configuration file has a modifiable part.

作为另一种实施方式,配置文件获取单元402用于获取对应环境下的配置文件,包括:As another implementation, the configuration file acquisition unit 402 is used to acquire the configuration file in the corresponding environment, including:

判断Vue项目类型是否属于预设的目标Vue项目类型;Determine whether the Vue project type belongs to the preset target Vue project type;

如果属于,则从Web服务端获取对应环境下的配置文件;If yes, obtain the configuration file in the corresponding environment from the Web server;

如果不属于,则在本地查找对应环境下的配置文件。If it does not, search for the configuration file in the corresponding environment locally.

本实施例提供的Vue项目配置装置与前述方法实施例属于同一发明构思,未在本实施例中描述的技术细节可参见前述方法实施例中的相关描述,在此不再赘述。The Vue project configuration device provided in this embodiment belongs to the same inventive concept as the aforementioned method embodiment. For technical details not described in this embodiment, please refer to the relevant description in the aforementioned method embodiment, which will not be repeated here.

图5为本发明电子设备一个实施例的结构示意图,可以实现本发明实施例一、实施例二或实施例三的流程,如图5所示,上述电子设备可以包括:壳体51、处理器52、存储器53、电路板54和电源电路55,其中,电路板54安置在壳体51围成的空间内部,处理器52和存储器53设置在电路板54上;电源电路55,用于为上述电子设备的各个电路或器件供电;存储器53用于存储可执行程序代码;处理器52通过读取存储器53中存储的可执行程序代码来运行与可执行程序代码对应的程序,用于执行前述任一实施例所述的Vue项目配置方法。Figure 5 is a schematic diagram of the structure of an embodiment of an electronic device of the present invention, which can implement the process of embodiment 1, embodiment 2 or embodiment 3 of the present invention. As shown in Figure 5, the above-mentioned electronic device may include: a shell 51, a processor 52, a memory 53, a circuit board 54 and a power supply circuit 55, wherein the circuit board 54 is arranged inside the space enclosed by the shell 51, and the processor 52 and the memory 53 are arranged on the circuit board 54; the power supply circuit 55 is used to supply power to various circuits or devices of the above-mentioned electronic device; the memory 53 is used to store executable program code; the processor 52 runs the program corresponding to the executable program code by reading the executable program code stored in the memory 53, so as to execute the Vue project configuration method described in any of the above-mentioned embodiments.

处理器52对上述步骤的具体执行过程以及处理器52通过运行可执行程序代码来进一步执行的步骤,可以参见本发明方法实施例的描述,在此不再赘述。The specific execution process of the above steps by the processor 52 and the steps further executed by the processor 52 by running the executable program code can be found in the description of the method embodiment of the present invention, which will not be repeated here.

该电子设备可以是以多种形式存在的具有数据处理功能的电子设备,例如,提供计算服务的服务器,其构成和通用的计算机架构类似,但是由于需要提供高可靠的服务,因此在处理能力、稳定性、可靠性、安全性、可扩展性、可管理性等方面要求较高。The electronic device can be an electronic device with data processing capabilities that exists in various forms, such as a server that provides computing services. Its structure is similar to a general computer architecture, but because it needs to provide highly reliable services, it has higher requirements in terms of processing power, stability, reliability, security, scalability, manageability, etc.

再者,本发明实施例还提供一种计算机可读存储介质,所述计算机可读存储介质存储有一个或多个程序,所述一个或者多个程序可被一个或者多个中央处理器执行,以实现前述实施例所述的Vue项目配置方法。Furthermore, an embodiment of the present invention also provides a computer-readable storage medium, which stores one or more programs. The one or more programs can be executed by one or more central processing units to implement the Vue project configuration method described in the above embodiment.

需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

本发明实施例中术语“和/或”,描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。字符“/”一般表示前后关联对象是一种“或”的关系。In the embodiments of the present invention, the term "and/or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and/or B may represent three situations: A exists alone, A and B exist at the same time, and B exists alone. The character "/" generally indicates that the associated objects before and after are in an "or" relationship.

本说明书中的各个实施例均采用相关的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referenced to each other, and each embodiment focuses on the differences from other embodiments.

尤其,对于装置实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

为了描述的方便,描述以上装置是以功能分为各种单元/模块分别描述。当然,在实施本发明时可以把各单元/模块的功能在同一个或多个软件和/或硬件中实现。For the convenience of description, the above device is described by dividing the functions into various units/modules. Of course, when implementing the present invention, the functions of each unit/module can be implemented in the same or multiple software and/or hardware.

本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的程序可存储于一计算机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。其中,所述的存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)或随机存储记忆体(Random AccessMemory,RAM)等。A person skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.

以上所述,仅为本发明的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到的变化或替换,都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应以权利要求的保护范围为准。The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed by the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (12)

1.一种Vue项目配置方法,其特征在于,应用于Web前端,所述方法包括:1. A Vue project configuration method, characterized in that it is applied to a Web front end, and the method comprises: 获取运行携带有Vue项目执行环境标识的打包命令后加载得到的环境文件;Get the environment file loaded after running the packaging command with the Vue project execution environment identifier; 读取环境文件中的Vue项目执行环境变量,获取对应环境下的配置文件;Read the Vue project execution environment variables in the environment file and obtain the configuration file in the corresponding environment; 将获取到的配置文件,替换Vue项目文件中对应的环境配置通用文件。The obtained configuration file will replace the corresponding environment configuration common file in the Vue project file. 2.根据权利要求1所述的方法,其特征在于,读取环境文件中的Vue项目执行环境变量,获取对应环境下的配置文件,包括:2. The method according to claim 1 is characterized in that reading the Vue project execution environment variables in the environment file to obtain the configuration file under the corresponding environment includes: 遍历Vue项目文件中的各环境配置通用文件:读取遍历到的环境配置通用文件名称;读取环境文件中的Vue项目执行环境变量;根据读取结果,获取对应环境下的配置文件。Traverse the common environment configuration files in the Vue project file: read the name of the traversed common environment configuration file; read the Vue project execution environment variables in the environment file; according to the reading result, obtain the configuration file in the corresponding environment. 3.根据权利要求1所述的方法,其特征在于,获取对应环境下的配置文件,包括:3. The method according to claim 1, wherein obtaining a configuration file under a corresponding environment comprises: 在本地查找对应环境下的配置文件;Search the configuration file for the corresponding environment locally; 如果查找成功,则:判断查找到的配置文件是否存在可修改方;如果存在可修改方,则从Web服务端获取对应环境下的配置文件,替换在本地查找到的配置文件;If the search is successful, then: determine whether the found configuration file has a modifiable side; if it does, obtain the configuration file in the corresponding environment from the Web server and replace the configuration file found locally; 如果查找失败,则从Web服务端获取对应环境下的配置文件。If the search fails, the configuration file for the corresponding environment is obtained from the Web server. 4.根据权利要求3所述的方法,其特征在于,判断查找到的配置文件是否存在可修改方,包括:4. The method according to claim 3, characterized in that determining whether the found configuration file has a modifiable side comprises: 识别查找到的配置文件包含的变量;Identify the variables contained in the found configuration file; 根据识别结果,确定查找到的配置文件是否存在可修改方。Based on the identification result, determine whether the found configuration file has a modifiable part. 5.根据权利要求1所述的方法,其特征在于,获取对应环境下的配置文件,包括:5. The method according to claim 1, wherein obtaining a configuration file under a corresponding environment comprises: 判断Vue项目类型是否属于预设的目标Vue项目类型;Determine whether the Vue project type belongs to the preset target Vue project type; 如果属于,则从Web服务端获取对应环境下的配置文件;If yes, obtain the configuration file in the corresponding environment from the Web server; 如果不属于,则在本地查找对应环境下的配置文件。If it does not, search for the configuration file in the corresponding environment locally. 6.一种Vue项目配置装置,其特征在于,应用于Web前端,所述装置包括:6. A Vue project configuration device, characterized in that it is applied to a Web front end, and the device comprises: 环境文件获取单元,用于获取运行携带有Vue项目执行环境标识的打包命令后加载得到的环境文件;An environment file acquisition unit, used to acquire an environment file loaded after running a packaging command carrying a Vue project execution environment identifier; 配置文件获取单元,用于读取环境文件中的Vue项目执行环境变量,获取对应环境下的配置文件;The configuration file acquisition unit is used to read the Vue project execution environment variables in the environment file and obtain the configuration file in the corresponding environment; 配置文件替换单元,用于将获取到的配置文件,替换Vue项目文件中对应的环境配置通用文件。The configuration file replacement unit is used to replace the corresponding environment configuration common file in the Vue project file with the acquired configuration file. 7.根据权利要求6所述的装置,其特征在于,配置文件获取单元用于读取环境文件中的Vue项目执行环境变量,获取对应环境下的配置文件,包括:7. The device according to claim 6 is characterized in that the configuration file acquisition unit is used to read the Vue project execution environment variables in the environment file to obtain the configuration file under the corresponding environment, including: 遍历Vue项目文件中的各环境配置通用文件:读取遍历到的环境配置通用文件名称;读取环境文件中的Vue项目执行环境变量;根据读取结果,获取对应环境下的配置文件。Traverse the common environment configuration files in the Vue project file: read the name of the traversed common environment configuration file; read the Vue project execution environment variables in the environment file; according to the reading result, obtain the configuration file in the corresponding environment. 8.根据权利要求6所述的装置,其特征在于,配置文件获取单元用于获取对应环境下的配置文件,包括:8. The device according to claim 6, wherein the configuration file acquisition unit is used to acquire the configuration file under the corresponding environment, including: 在本地查找对应环境下的配置文件;Search the configuration file for the corresponding environment locally; 如果查找成功,则:判断查找到的配置文件是否存在可修改方;如果存在可修改方,则从Web服务端获取对应环境下的配置文件,替换在本地查找到的配置文件;If the search is successful, then: determine whether the found configuration file has a modifiable side; if it does, obtain the configuration file in the corresponding environment from the Web server and replace the configuration file found locally; 如果查找失败,则从Web服务端获取对应环境下的配置文件。If the search fails, the configuration file for the corresponding environment is obtained from the Web server. 9.根据权利要求8所述的装置,其特征在于,配置文件获取单元用于判断查找到的配置文件是否存在可修改方,包括:9. The device according to claim 8, characterized in that the configuration file acquisition unit is used to determine whether the found configuration file has a modifiable side, comprising: 识别查找到的配置文件包含的变量;Identify the variables contained in the found configuration file; 根据识别结果,确定查找到的配置文件是否存在可修改方。Based on the identification result, determine whether the found configuration file has a modifiable part. 10.根据权利要求6所述的装置,其特征在于,配置文件获取单元用于获取对应环境下的配置文件,包括:10. The device according to claim 6, wherein the configuration file acquisition unit is used to acquire the configuration file under the corresponding environment, including: 判断Vue项目类型是否属于预设的目标Vue项目类型;Determine whether the Vue project type belongs to the preset target Vue project type; 如果属于,则从Web服务端获取对应环境下的配置文件;If yes, obtain the configuration file in the corresponding environment from the Web server; 如果不属于,则在本地查找对应环境下的配置文件。If it does not, search for the configuration file in the corresponding environment locally. 11.一种电子设备,其特征在于,所述电子设备包括:壳体、处理器、存储器、电路板和电源电路,其中,电路板安置在壳体围成的空间内部,处理器和存储器设置在电路板上;电源电路,用于为上述电子设备的各个电路或器件供电;存储器用于存储可执行程序代码;处理器通过读取存储器中存储的可执行程序代码来运行与可执行程序代码对应的程序,用于执行前述1-5中任一权利要求所述的Vue项目配置方法。11. An electronic device, characterized in that the electronic device comprises: a shell, a processor, a memory, a circuit board and a power supply circuit, wherein the circuit board is placed inside the space enclosed by the shell, and the processor and the memory are arranged on the circuit board; the power supply circuit is used to supply power to various circuits or devices of the above-mentioned electronic device; the memory is used to store executable program code; the processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory, so as to execute the Vue project configuration method described in any one of the above claims 1-5. 12.一种计算机可读存储介质,其特征在于,所述计算机可读存储介质存储有一个或者多个程序,所述一个或者多个程序可被一个或者多个中央处理器执行,以实现前述1-5中任一权利要求所述的Vue项目配置方法。12. A computer-readable storage medium, characterized in that the computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more central processing units to implement the Vue project configuration method described in any of the above claims 1-5.
CN202410629312.2A 2024-05-21 2024-05-21 A Vue project configuration method, device, electronic device and storage medium Pending CN118567745A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410629312.2A CN118567745A (en) 2024-05-21 2024-05-21 A Vue project configuration method, device, electronic device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410629312.2A CN118567745A (en) 2024-05-21 2024-05-21 A Vue project configuration method, device, electronic device and storage medium

Publications (1)

Publication Number Publication Date
CN118567745A true CN118567745A (en) 2024-08-30

Family

ID=92468837

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410629312.2A Pending CN118567745A (en) 2024-05-21 2024-05-21 A Vue project configuration method, device, electronic device and storage medium

Country Status (1)

Country Link
CN (1) CN118567745A (en)

Similar Documents

Publication Publication Date Title
US11216256B2 (en) Determining based on static compiler analysis that execution of compiler code would result in unacceptable program behavior
US11650905B2 (en) Testing source code changes
CN106559438B (en) A program upload method and device based on a target network platform
US8719784B2 (en) Assigning runtime artifacts to software components
KR20200021993A (en) Blockchain compiler
CN112733158B (en) Android system vulnerability detection method, electronic equipment and storage medium
US11531763B1 (en) Automated code generation using analysis of design diagrams
CN106649120A (en) Data acquisition method, and data analysis method and system
JP7119096B2 (en) license verification device
CN112631894B (en) Code detection method, device, storage medium and computer equipment
Arzt et al. The soot-based toolchain for analyzing android apps
CN113760339A (en) Vulnerability repair method and device
CN110597496A (en) Method and device for acquiring bytecode file of application program
Li et al. We urgently need privilege management in mcp: A measurement of api usage in mcp ecosystems
US11989291B2 (en) System, method, and apparatus for software verification
CN111159301A (en) Data creating method, device, equipment and storage medium based on intelligent contract
Santhanam et al. Scraping sticky leftovers: App user information left on servers after account deletion
CN116414433A (en) Resource packaging method, device, equipment and computer readable medium
CN118689529A (en) A method, system, device and medium for configuring parameters of application services
CN118567745A (en) A Vue project configuration method, device, electronic device and storage medium
CN113987518B (en) Trusted computing method and device
Hermann et al. Getting to know you: Towards a capability model for java
CN115712898A (en) Source code auditing method and device, electronic equipment and storage medium
CN113486330B (en) Application program running method, device, equipment and storage medium
CN115269058B (en) A WPF resource loading method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination