Small program page conversion method and device, electronic equipment and storage medium
By performing feature extraction and clustering on Vue pages and combining conversion strategies, automatic conversion of mini-program pages is realized, solving the problems of high conversion costs and long cycles in the existing technology, and improving efficiency and adaptability.
Patent Information
- Application Number
- CN202510285592.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-11
- Publication Date
- 2025-06-20
AI Technical Summary
The existing technology has high investment cost and long development cycle. It is impossible to quickly complete the automatic conversion from Vue page to mini program, and cannot meet the development requirements of rapid operation iteration of the business side.
By extracting feature of multiple Vue pages to be converted, the page features are obtained; clustering is performed based on page features to obtain clustering results; for each class cluster, the Vue page is converted into a applet page based on its common features.
It realizes automation of mini-program page conversion, reduces conversion costs, improves conversion efficiency, and can quickly adapt to business iteration needs.
Smart Images

Figure CN120179244A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data processing, and in particular, to a method, device, electronic device and storage medium for converting applet pages. Background Art
[0002] As an application form within an application, an applet needs to comply with many regulations and characteristic requirements of the application. For example, there are specific specifications and restrictions on aspects such as network requests, user authorization, and data storage, which are inconsistent with the processing methods of Vue in the Web development scenario. Therefore, Vue pages cannot be directly published as applets.
[0003] Currently, for lightweight Vue pages, they cannot be directly published as applets and need to be re-developed following the syntax of applet applications. It is impossible to quickly complete the automatic conversion from Vue pages to applets, resulting in high input costs and long development cycles for applet page conversion, and unable to meet the development requirements of rapid operation and iteration on the business side.
[0004] Therefore, how to reduce the cost of applet page conversion and improve the efficiency of applet page conversion has become an urgent technical problem to be solved. Summary of the Invention
[0005] The present invention provides a method, device, electronic device and storage medium for converting applet pages to solve the defects of high input costs and long development cycles in the prior art for applet page conversion.
[0006] The present invention provides a method for converting applet pages, including the following steps: Extract features from multiple Vue pages to be converted to obtain page features; Based on the page features, perform clustering processing to obtain a clustering result, where the clustering result includes multiple clusters, and each cluster includes multiple Vue pages to be converted; For any one of the clusters, based on the common features of the Vue pages to be converted in the cluster, use the corresponding conversion strategy to convert the Vue pages to be converted in the cluster into applet pages.
[0007] According to the method for converting applet pages provided by the present invention, the extracting features from multiple Vue pages to be converted to obtain page features includes: Extract features based on the page complexity, layout style, and usage of specific components of the multiple Vue pages to be converted to obtain page features; Wherein, the page complexity includes the number of components and the number of instructions; the layout style is the organization and arrangement method of elements in the page.
[0008] A mini-program page conversion method provided by the present invention, based on the page features, performs clustering processing to obtain a clustering result, including: Determine the number of clusters; Based on the number of clusters, initialize the cluster centers; Based on the page features of each Vue page to be converted, determine the distance from each Vue page to be converted to each cluster center; Based on the distances, assign each Vue page to be converted to the cluster where the nearest cluster center is located; After determining the cluster to which each Vue page to be converted belongs, update the cluster center of each cluster; Based on the new cluster centers, iteratively update the clusters to which each Vue page to be converted belongs until a preset iteration stop condition is reached to obtain a clustering result.
[0009] A mini-program page conversion method provided by the present invention determines the number of clusters based on the following steps: For each K value in a preset K value range, after clustering using a clustering algorithm, calculate the sum of the squares of the distances between the points within each cluster and the cluster center; Based on the K value and the corresponding sum of the squares of the distances, draw a curve; Take the K value corresponding to the elbow point in the curve as the number of clusters.
[0010] A mini-program page conversion method provided by the present invention determines the number of clusters based on the following steps: For each K value in a preset K value range, after clustering using a clustering algorithm, calculate the silhouette coefficient corresponding to the clustering result; Take the K value corresponding to the maximum silhouette coefficient as the number of clusters, and the maximum silhouette coefficient is the maximum value among the silhouette coefficients.
[0011] A mini-program page conversion method provided by the present invention, based on the common features of the Vue pages to be converted in the cluster, uses corresponding conversion strategies to convert the Vue pages to be converted in the cluster into mini-program pages, including: If the common feature of the Vue pages to be converted in the cluster is including HTML tags, based on a preset tag replacement rule, replace the HTML tags of the Vue pages to be converted in the cluster with tags under the target framework; If the common feature of the Vue pages to be converted in the cluster is including a Vue router manager, replace the Vue route jump logic of the Vue pages to be converted in the cluster with a navigation API under the target framework; If the common feature of the Vue pages to be converted in the cluster is that they include specific custom components, then based on the preset component replacement rules, replace the custom components of the Vue pages to be converted in the cluster with the specified components in the component library under the target framework.
[0012] The present invention also provides a mini-program page conversion device, including the following modules: A feature extraction module, configured to: extract features from multiple Vue pages to be converted to obtain page features; A page clustering module, configured to: perform clustering processing based on the page features to obtain a clustering result, where the clustering result includes multiple clusters, and each of the clusters includes multiple of the Vue pages to be converted; A page conversion module, configured to: for any one of the clusters, based on the common features of the Vue pages to be converted in the cluster, use the corresponding conversion strategy to convert the Vue pages to be converted in the cluster into mini-program pages.
[0013] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, the mini-program page conversion method as described in any one of the above is implemented.
[0014] The present invention also provides a non-transitory computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the mini-program page conversion method as described in any one of the above is implemented.
[0015] The present invention also provides a computer program product, including a computer program. When the computer program is executed by a processor, the mini-program page conversion method as described in any one of the above is implemented.
[0016] The mini-program page conversion method, device, electronic device, and storage medium provided by the present invention extract features from multiple Vue pages to be converted to obtain page features; perform clustering processing based on the page features to obtain a clustering result, where the clustering result includes multiple clusters, and each of the clusters includes multiple of the Vue pages to be converted; for any one of the clusters, based on the common features of the Vue pages to be converted in the cluster, use the corresponding conversion strategy to convert the Vue pages to be converted in the cluster into mini-program pages. The mini-program page conversion method provided by the present invention automatically converts Vue pages into mini-program pages without manual re-development, reduces the mini-program page conversion cost, and improves the mini-program page conversion efficiency; by using a clustering algorithm, similar Vue pages are grouped as one category and processed uniformly according to the category, solving the efficiency problem of separately searching and converting each page one by one, realizing batch page conversion, and further improving the mini-program page conversion efficiency. Brief Description of the Drawings
[0017] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0018] Figure 1 It is one of the flow diagrams of the mini-program page conversion method provided by the present invention; Figure 2 It is another flow diagram of the mini-program page conversion method provided by the present invention; Figure 3 It is yet another flow diagram of the mini-program page conversion method provided by the present invention; Figure 4 It is the structural diagram of the mini-program page conversion device provided by the present invention; Figure 5 It is the structural diagram of the electronic device provided by the present invention. Detailed Embodiments
[0019] To make the objectives, technical solutions, and advantages of the present invention clearer, the following will clearly and completely describe the technical solutions in the present invention in conjunction with the drawings in the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art without creative efforts based on the embodiments in the present invention fall within the protection scope of the present invention.
[0020] It should be noted that in the description of the embodiments of the present invention, 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 not only includes those elements, but also includes other elements not expressly listed, or elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "including one..." does not exclude the existence of additional identical elements in the process, method, article or device including the said element. The orientation or positional relationship indicated by terms such as "upper", "lower", etc. is based on the orientation or positional relationship shown in the drawings, and is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and thus cannot be construed as a limitation of the present invention. Unless otherwise expressly specified and defined, the terms "mounted", "connected", "coupled" should be understood in a broad sense. For example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection, an electrical connection; it can be directly connected, or indirectly connected through an intermediate medium, and can be the communication inside two elements. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0021] The terms "first", "second", etc. in this application are used to distinguish similar objects, rather than to describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances so that the embodiments of this application can be implemented in an order other than those illustrated or described herein, and the objects distinguished by "first", "second", etc. are generally of the same category, and do not limit the number of objects. For example, the first object can be one or multiple. In addition, "and / or" means at least one of the connected objects, and the character " / ", generally indicates an "or" relationship between the associated objects before and after.
[0022] Next, in combination with Figures 1 - 5 describe the mini-program page conversion method, device, electronic device and storage medium provided by the embodiments of the present invention.
[0023] Figure 1 is one of the flow diagrams of the mini-program page conversion method provided by the present invention. As Figure 1 shown, the method includes the following: S110, extract features from multiple Vue pages to be converted to obtain page features; S120, based on the page features, perform clustering processing to obtain a clustering result, the clustering result includes multiple clusters, and each of the clusters includes multiple of the Vue pages to be converted; S130. For any of the said clusters, based on the common features of the Vue pages to be converted in the cluster, use the corresponding conversion strategy to convert the Vue pages to be converted in the cluster into mini-program pages.
[0024] It should be noted that the execution subject of the mini-program page conversion method provided in the embodiments of this application can be a server or a computer device, such as a mobile phone, a tablet computer, a notebook computer, a handheld computer, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA), etc.
[0025] In S110, a large amount of Vue page data is collected. These data can come from different Vue projects. Feature extraction is performed on each Vue page to obtain the page features of each Vue page. The page features are vectors representing the features of the Vue page. Here, the specific algorithm used for feature extraction is not limited.
[0026] In S120, the clustering algorithm used for clustering processing is not limited here. For example, it can use algorithms including but not limited to the K-means clustering algorithm, the mean shift clustering algorithm, the maximum expectation clustering algorithm of the Gaussian mixture model, etc.
[0027] One Vue page usually consists of the following four main parts. Through the collaborative work of these four parts, the page realizes rich interactions and dynamic effects: 1. HTML template (Template), which is the structural part of the page and uses specific syntax to describe the elements and layout of the page; 2. JavaScript script (Script), which contains the logic of the page, such as data definition, methods, life cycle hooks, etc.; 3. CSS style (Style), which is used for the style setting of the page; 4. Components, the page may consist of multiple custom components, and each component has its own independent template, script, and style.
[0028] For the above Vue pages, if you want to convert the Vue pages into the mini-program format, manual processing needs to perform hard coding, replacement, and repackaging from the following four aspects: 1. Tag replacement (1) It is necessary to replace the block-level elements such as div, p, h1~h5 in the Vue page with the view tag. Among them, the font sizes of h1~h5 need to be adjusted correspondingly according to the page size; (2)All inline elements such as span and label should be replaced with text tags. Among them, for the text font size, the selector must select the text tag to modify the font size because the text tag has a default property of 12px size. (3)The img should be replaced with an image tag. Among them, the image tag must be closed, otherwise an error will be reported during runtime.
[0029] 2. Style replacement (1)The header area on the page should be changed to use the lan-header component. (2)The rem unit should be replaced with the rpx unit.
[0030] 3. Method replacement (1)The page toast prompt method this.$tips.showToast() should be replaced with this.$lan.showToast(). (2)The method of pulling up the external sharing wxshare() should be replaced with this.$lan.shareTo(). (3)The method of verifying the login status getloginNumber() should be replaced with this.$lan.login.pageLogin(). (4)The method related to type matching isMobile() should be replaced with this.$lan.isMobile(). (5)The axios in the public httpCore.js request should be replaced with service.
[0031] 4. Path replacement (1)The relevant path configuration pages.json should be replaced with process / index.js.
[0032] For an existing project, there are hundreds or thousands of pages. If all are searched and replaced manually, the labor input is huge and it cannot meet the requirements of rapid business access and adaptation.
[0033] In S130, the above steps are centralized and automated for processing to quickly complete the engineering and page-level adaptive conversion. Specifically: Figure 2 It is the second flow diagram of the mini-program page conversion method provided by the present invention. As Figure 2 shown, the template structure of the Vue page is migrated to the page file (.vue) of UniApp. Among them, for the way UniApp references components, it may be necessary to import components using the import statement; adjust the properties and event bindings of the components according to the component specifications of UniApp. Convert the route configuration in Vue to the format of UniApp, including page paths, page parameters, etc. Usually, route configuration is done in the pages.json file; Check the style code in Vue pages, especially styles with specific browser prefixes, and automatically complete the adaptation conversion for UniApp; Sort out the browser APIs used in Vue pages, such as fetch, localStorage, etc., and replace these APIs with the corresponding cross-platform APIs provided by UniApp. For example, use uni.request to replace fetch and use uni.setStorageSync to replace localStorage; Use the debugging tools provided by UniApp to view the rendering effect, performance, and error information of the converted pages and make manual fine-tuning to ensure that the conversion results meet the requirements of UniApp usage.
[0034] In S130, analyze the characteristics of each cluster, obtain the common features and requirements of the Vue pages in the cluster; formulate a dedicated conversion strategy for each cluster. For example, for a cluster with a large number of specific types of components, a specific conversion method can be adopted; convert the cluster to which each Vue page belongs, and convert the Vue page to a UniApp page according to the formulated conversion strategy, and finally obtain the converted UniApp applet page.
[0035] The applet page conversion method provided by the embodiments of the present invention extracts features from multiple Vue pages to be converted to obtain page features; based on the page features, clustering processing is performed to obtain a clustering result, where the clustering result includes multiple clusters, and each cluster includes multiple of the Vue pages to be converted; for any one of the clusters, based on the common features of the Vue pages to be converted in the cluster, the Vue pages to be converted in the cluster are converted to applet pages using the corresponding conversion strategy. The applet page conversion method provided by the present invention automatically converts Vue pages into applet pages without manual re-development, reducing the cost of applet page conversion and improving the efficiency of applet page conversion; by using a clustering algorithm, similar Vue pages are grouped as a category and processed uniformly according to the category, solving the efficiency problem of searching and converting each page one by one, realizing batch page conversion, and further improving the efficiency of applet page conversion.
[0036] In an alternative embodiment, the extracting features from multiple Vue pages to be converted to obtain page features includes: Extract features based on the page complexity, layout style, and specific component usage of the multiple Vue pages to be converted to obtain page features; Among them, the page complexity includes the number of components and the number of instructions; the layout style is the way of organizing and arranging elements in the page.
[0037] In the embodiments of the present invention, a large amount of Vue page data is collected, and this data can come from different Vue projects; feature extraction is performed on each Vue page, such as the page complexity, layout style, usage of specific components, etc. Among them, the calculation of page complexity includes, but is not limited to, indicators such as the number of components and the number of instructions. The layout style is the way of organizing and arranging elements in the page. Common Vue page layout styles include: responsive design (using CSS media queries, flexible grid systems, and relative units to adjust the size and position of page elements), component-based layout (decomposing the page into multiple independent but combinable widgets, and each component is responsible for its own logic and style), three-column layout (including a left navigation bar, a middle main content area, and a right sidebar widget), top navigation + sidebar layout (the top navigation bar contains global operation buttons, and the sidebar provides menu options to allow users to quickly jump to different function modules), etc. The usage of specific components refers to the usage of specified components in Vue pages.
[0038] The mini-program page conversion method provided by the embodiments of the present invention performs feature extraction on page complexity, layout style, and usage of specific components, obtains page features that accurately represent the characteristics of Vue pages, and provides a reliable data basis for subsequent page clustering.
[0039] In an optional embodiment, performing clustering processing based on the page features to obtain a clustering result includes: Determining the number of clusters; Initializing the cluster centers based on the number of clusters; Based on the page features of each Vue page to be converted, determining the distance from each Vue page to be converted to each cluster center; Based on the distances, respectively allocating each Vue page to be converted to the cluster where the nearest cluster center is located; After determining the cluster to which each Vue page to be converted belongs, updating the cluster center of each cluster; Based on the new cluster centers, iteratively updating the clusters to which each Vue page to be converted belongs until a preset iteration stop condition is reached to obtain a clustering result.
[0040] In the embodiments of the present invention, considering the actual business scenarios, in a stock project, there are often a large number of similar functional logics on different pages. For example, obtaining the user's mobile phone number, sending SMS verification codes, selecting the broadband installation address, etc. Due to different business domains, these functions are often scattered on different pages. For the overall project-level replacement, there are the same replacement actions, but each page is executed again from the beginning, which seriously affects the execution efficiency. Therefore, the K-Means clustering algorithm is introduced. By quickly clustering and grouping a large number of Vue pages, for each cluster, the typical pages can be analyzed to understand the characteristics and requirements of the cluster. Then, a unified conversion strategy is formulated and applied to all pages in the cluster to improve the conversion efficiency.
[0041] Figure 3 It is the third flow schematic diagram of the mini-program page conversion method provided by the present invention. As Figure 3 shown, after determining the number of clusters K, randomly select K initial cluster centers. For each Vue page, calculate its distance to each cluster center; according to the distance calculation results, assign each Vue page to the cluster where the nearest cluster center is located; recalculate the cluster center of each cluster, that is, calculate the mean value of the features of all Vue pages in the cluster; repeat the above steps until the preset iteration stop condition is reached.
[0042] Here, the preset iteration stop condition may include but is not limited to reaching the maximum number of iterations, the change amount of the cluster center point being less than the preset threshold, the clustering result remaining unchanged after iteration, and the data point allocation being stable (in consecutive multiple iterations, the proportion of data points being reassigned to other center points is less than the threshold).
[0043] In some embodiments, determine whether the cluster center is stable or whether the preset number of iterations has been reached. If it is not stable and the number of iterations has not been reached, return to the step of calculating the distance to continue the iteration; if it is stable or the number of iterations has been reached, complete the clustering to obtain the clustering result.
[0044] The mini-program page conversion method provided by the embodiments of the present invention introduces the K-Means clustering algorithm. By quickly clustering and grouping a large number of Vue pages, for each cluster, analyze the typical pages in it, understand the characteristics and requirements of the cluster, formulate a unified conversion strategy, and then apply it to all pages in the cluster to improve the conversion efficiency; the K-Means clustering algorithm has a low time complexity and is suitable for processing large-scale data such as stock projects, improving the calculation efficiency.
[0045] In an alternative embodiment, determine the number of clusters based on the following steps: For each K value in the preset K value range, after clustering using the clustering algorithm, calculate the sum of the squares of the distances between the points within each cluster and the cluster center; Draw a curve based on the K value and the corresponding sum of squared distances. Take the K value corresponding to the elbow point in the curve as the number of clusters.
[0046] In the embodiments of the present invention, for each possible K value (e.g., from 1 to a preset upper limit value), run the clustering algorithm and calculate the sum of squared errors within all clusters WCSS (i.e., the sum of the squared distances from each point to the cluster center of its belonging cluster); plot the WCSS corresponding to different K values as a line graph. Generally, as the K value increases, the WCSS will gradually decrease because more clusters mean that the points in each cluster are closer to the cluster center; find an inflection point on the line graph, which is the elbow. After this point, although the K value continues to increase, the decrease in WCSS becomes significantly slower. The K value corresponding to this point is the more ideal number of clusters.
[0047] The small program page conversion method provided by the embodiments of the present invention uses the elbow method to calculate the K value, which is simple and intuitive, does not require setting additional parameters, can quickly calculate the optimal K value, and provides a better number of clusters for the subsequent clustering algorithm.
[0048] In an alternative embodiment, determine the number of clusters based on the following steps: For each K value in the preset K value range, after clustering using the clustering algorithm, calculate the silhouette coefficient corresponding to the clustering result; Take the K value corresponding to the maximum silhouette coefficient as the number of clusters, where the maximum silhouette coefficient is the maximum value among the silhouette coefficients.
[0049] In the embodiments of the present invention, for each data point, calculate the average distance within the cluster , that is, the average distance between the data point and all other points in the same cluster, which represents the compactness within the cluster; calculate the average distance to the nearest cluster , that is, the average distance from the data point to all points in the nearest cluster that does not belong to it, which reflects the separation between clusters; calculate the silhouette coefficient based on the following formula: ; Its value ranges between -1 and 1. When is close to 1, it indicates that the data point 𝑖 is reasonably clustered, with a small distance within the cluster and a large distance between clusters; when is close to 0, it means that the data point 𝑖 is on the boundary of two clusters and may belong to either cluster; when is close to -1, it indicates that the data point 𝑖 may be wrongly assigned to an adjacent cluster. The silhouette coefficient of the entire data set is the average of the silhouette coefficients of all data points. The larger the silhouette coefficient, the better the effect of the clustering algorithm.
[0050] The small program page conversion method provided by the embodiment of the present invention determines the number of clusters through the silhouette coefficient, comprehensively considers the compactness within the clusters and the separation between the clusters, comprehensively evaluates the clustering quality, thereby determining the optimal number of clusters, and further improving the clustering effect.
[0051] Based on any of the above embodiments, based on the common features of the Vue pages to be converted in the cluster, using the corresponding conversion strategy to convert the Vue pages to be converted in the cluster into small program pages, including: If the common feature of the Vue pages to be converted in the cluster is including HTML tags, based on the preset tag replacement rule, replace the HTML tags of the Vue pages to be converted in the cluster with the tags under the target framework; If the common feature of the Vue pages to be converted in the cluster is including a Vue route manager, replace the Vue route jump logic of the Vue pages to be converted in the cluster with the navigation API under the target framework; If the common feature of the Vue pages to be converted in the cluster is including specific custom components, based on the preset component replacement rule, replace the custom components of the Vue pages to be converted in the cluster with the specified components in the component library under the target framework.
[0052] In the embodiment of the present invention, the target framework is UniApp.
[0053] Next, the small program page conversion device provided by the embodiment of the present application will be described. The small program page conversion device described below can be correspondingly referred to the small program page conversion method described above.
[0054] Figure 4 It is a schematic structural diagram of the small program page conversion device provided by the present invention, as Figure 4 shown. The small program page conversion device may include but is not limited to; A feature extraction module 410, configured to: extract features from multiple Vue pages to be converted to obtain page features; A page clustering module 420, configured to: perform clustering processing based on the page features to obtain a clustering result, where the clustering result includes multiple clusters, and each of the clusters includes multiple of the Vue pages to be converted; A page conversion module 430, configured to: for any of the clusters, based on the common features of the Vue pages to be converted in the cluster, use the corresponding conversion strategy to convert the Vue pages to be converted in the cluster into small program pages.
[0055] It should be noted that the small program page conversion device provided by the embodiment of the present invention, when specifically running, can execute the small program page conversion method described in any of the above embodiments, and this embodiment will not be elaborated herein.
[0056] Figure 5 Illustrates a schematic diagram of the physical structure of an electronic device, as Figure 5 shown. The electronic device may include: a processor 510, a communications interface 520, a memory 530, and a communication bus 540. Among them, the processor 510, the communications interface 520, and the memory 530 complete communication with each other through the communication bus 540. The processor 510 may call the logical instructions in the memory 530 to execute the small program page conversion method, which includes: extracting features from multiple Vue pages to be converted to obtain page features; Based on the page features, performing clustering processing to obtain a clustering result, the clustering result includes multiple clusters, and each of the clusters includes multiple of the Vue pages to be converted; For any one of the clusters, based on the common features of the Vue pages to be converted in the cluster, use the corresponding conversion strategy to convert the Vue pages to be converted in the cluster into small program pages.
[0057] In addition, when the logical instructions in the above-mentioned memory 530 are implemented in the form of software functional units and sold or used as an independent product, they can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present invention. The foregoing storage medium includes: USB flash drives, mobile hard disks, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), magnetic disks, or optical disks, etc., which can store program codes.
[0058] On the other hand, the present invention also provides a computer program product. The computer program product includes a computer program. The computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the small program page conversion method provided by the above-mentioned various methods. The method includes: extracting features from multiple Vue pages to be converted to obtain page features; Based on the page features, performing clustering processing to obtain a clustering result, the clustering result includes multiple clusters, and each of the clusters includes multiple of the Vue pages to be converted; For any of the clusters, based on the common features of the Vue pages to be converted in the cluster, use the corresponding conversion strategy to convert the Vue pages to be converted in the cluster into mini-program pages.
[0059] In another aspect, the present invention also provides a non-transitory computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it is configured to execute the mini-program page conversion method provided by the above-mentioned various methods. The method includes: extracting features from multiple Vue pages to be converted to obtain page features; Based on the page features, perform clustering processing to obtain a clustering result. The clustering result includes multiple clusters, and each cluster respectively includes multiple Vue pages to be converted; For any of the clusters, based on the common features of the Vue pages to be converted in the cluster, use the corresponding conversion strategy to convert the Vue pages to be converted in the cluster into mini-program pages.
[0060] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art can understand and implement it without creative effort.
[0061] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the essence of the above technical solution, or the part that contributes to the prior art, can be embodied in the form of a software product. The computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0062] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for converting a mini program page, characterized in that: include: Extract features of multiple Vue pages to be converted to obtain page features; Based on the page features, clustering processing is performed to obtain a clustering result, wherein the clustering result includes a plurality of clusters, and each of the clusters includes a plurality of the Vue pages to be converted; For any of the clusters, based on the common features of the Vue pages to be converted in the cluster, a corresponding conversion strategy is used to convert the Vue pages to be converted in the cluster into mini program pages.
2. The applet page conversion method according to claim 1, characterized in that: The feature extraction of the multiple Vue pages to be converted to obtain page features includes: Perform feature extraction based on page complexity, layout style, and specific component usage of the multiple Vue pages to be converted to obtain page features; The page complexity includes the number of components and the number of instructions; the layout style is the organization and arrangement of elements in the page.
3. The applet page conversion method according to claim 1, characterized in that: The clustering process is performed based on the page features to obtain a clustering result, including: Determine the number of clusters; Initializing cluster centers based on the number of clusters; Based on the page features of each of the Vue pages to be converted, determining the distance between each of the Vue pages to be converted and each of the cluster centers; Based on the distances, each of the Vue pages to be converted is assigned to the cluster with the closest cluster center; After determining the cluster to which each of the Vue pages to be converted belongs, updating the cluster center of each of the clusters; Based on the new cluster center, the cluster to which each Vue page to be converted belongs is iteratively updated until a preset iteration stop condition is reached to obtain a clustering result.
4. The applet page conversion method according to claim 3, characterized in that: The number of clusters is determined based on the following steps: For each K value in the preset K value range, after clustering using the clustering algorithm, the sum of the squares of the distances between the points in each cluster and the cluster center is calculated; Based on the K value and the corresponding distance square sum, a curve is drawn; The K value corresponding to the elbow point in the curve is used as the number of clusters.
5. The applet page conversion method according to claim 1, characterized in that: The number of clusters is determined based on the following steps: For each K value in the preset K value range, clustering is performed using a clustering algorithm, and the silhouette coefficient corresponding to the clustering result is calculated; The K value corresponding to the maximum value of the silhouette coefficient is used as the number of clusters, and the maximum value of the silhouette coefficient is the maximum value among the silhouette coefficients.
6. The method for converting a mini program page according to any one of claims 1 to 5, characterized in that: The converting the Vue pages to be converted in the cluster into mini program pages using corresponding conversion strategies based on the common features of the Vue pages to be converted in the cluster includes: If the common feature of the Vue pages to be converted in the cluster is that they include HTML tags, then based on a preset tag replacement rule, the HTML tags of the Vue pages to be converted in the cluster are replaced with tags under the target framework; If the common feature of the Vue pages to be converted in the cluster is that they include a Vue routing manager, then the Vue routing jump logic of the Vue pages to be converted in the cluster is replaced with the navigation API under the target framework; If the common feature of the Vue pages to be converted in the cluster is that they include specific custom components, then based on the preset component replacement rule, the custom components of the Vue pages to be converted in the cluster are replaced with designated components in the component library under the target framework.
7. A small program page conversion device, characterized in that: include: The feature extraction module is used to: extract features from multiple Vue pages to be converted to obtain page features; A page clustering module, used to: perform clustering processing based on the page features to obtain a clustering result, wherein the clustering result includes a plurality of clusters, and each of the clusters includes a plurality of the Vue pages to be converted; The page conversion module is used to: for any of the clusters, based on the common characteristics of the Vue pages to be converted in the cluster, use a corresponding conversion strategy to convert the Vue pages to be converted in the cluster into mini program pages.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that: When the processor executes the computer program, the mini-program page conversion method as described in any one of claims 1 to 6 is implemented.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the mini-program page conversion method as described in any one of claims 1 to 6 is implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the mini-program page conversion method as described in any one of claims 1 to 6 is implemented.