CN-121979543-A - Page updating method and device
Abstract
One or more embodiments of the present disclosure provide a method and apparatus for updating a page. The page update method is applied to an electronic device, wherein the electronic device is configured with a browser IDE and a command line tool, and the browser IDE is in communication connection with the command line tool and comprises a preview interface. According to the method, the target page element selected by the user and the adjustment instruction aiming at the target page element can be obtained based on the browser IDE, the adjustment instruction is sent to the command line tool, so that the command line tool modifies the running code of the target page element based on the adjustment instruction, and then the browser IDE can respond to the command line tool to modify the running code and display the updated target page based on the preview interface.
Inventors
- LI HAO
Assignees
- 支付宝(杭州)数字服务技术有限公司
Dates
- Publication Date
- 20260505
- Application Date
- 20260116
Claims (17)
- 1. A method for updating a page, the method being applied to an electronic device, the electronic device being configured with a browser IDE and a command line tool, the browser IDE being communicatively coupled to the command line tool, the browser IDE comprising a preview interface, the method comprising: based on the browser IDE, acquiring a target page element selected by a user and an adjustment instruction aiming at the target page element, and sending the adjustment instruction to the command line tool so that the command line tool modifies the running code of the target page element based on the adjustment instruction; and modifying the running code in response to the command line tool, and displaying an updated target page based on the preview interface.
- 2. The method for updating a page according to claim 1, wherein the step of obtaining the target page element selected by the user comprises: acquiring a target page selected by a user; And acquiring the DOM element selected by the user on the target page, and taking the DOM element as the target page element.
- 3. The method of claim 2, wherein the browser IDE further comprises a navigation interface, and wherein the obtaining the user-selected target page comprises: Acquiring a page to be updated selected by a user through the navigation interface; Acquiring an access address of the page to be updated; And displaying the page to be updated on the preview interface based on the access address, and taking the page to be updated as the target page.
- 4. The method of claim 3, wherein the browser IDE is communicatively coupled to the command line tool over a dual channel, the dual channel comprising a first channel and a second channel, the obtaining the access address of the page to be updated comprising: the browser IDE sends the page to be updated selected by the user to the command line tool through the first channel; The command line tool generates a corresponding access address based on the running file path of the page to be updated, and sends the access address to the browser IDE through the second channel.
- 5. The method for updating a page according to claim 2, wherein the obtaining the DOM element selected by the user on the target page includes: adding DOM element interaction script to the target page; Detecting user interaction action based on the DOM element interaction script; and determining DOM elements selected by the user based on the interaction.
- 6. The page update method of claim 4, wherein the method further comprises: adding labels for all DOM elements in the target page; the labels are associated with code paths of each DOM element, and the code paths are used for indicating positions of codes corresponding to the DOM elements in the running file of the target page.
- 7. The page update method according to claim 6, wherein the acquiring the adjustment instruction for the target page element includes: acquiring an adjustment intention input by a user aiming at the target page element; the adjustment intent is packaged as the adjustment instruction.
- 8. The page updating method according to claim 7, wherein the obtaining the adjustment intention for the target page element input by the user includes: In response to a target page element selected by a user, an adjustment intent for the target page element entered by the user in text form or in speech form is received.
- 9. The page updating method according to claim 7, wherein the obtaining the adjustment intention for the target page element input by the user includes: responding to a target page element selected by a user, and displaying a configuration panel, wherein the configuration panel is provided with preset adjustment options or parameter adjustment controls matched with the target page element; Based on the configuration panel, receiving a selection operation of a user on the preset adjustment options or an adjustment operation of the parameter adjustment control; the adjustment intention is obtained based on the selection operation or the adjustment operation.
- 10. The page update method of claim 7 wherein the command line tool modifies the run code of the target page element based on the adjustment instruction, comprising: Acquiring a tag of the target page element and the adjustment intention based on the adjustment instruction; Determining a code path corresponding to the target page element based on the tag; And modifying the running code of the target page element based on the adjustment intention and the code path.
- 11. The page update method of claim 10, wherein the modifying the running code of the target page element based on the adjustment intent and the code path comprises: Calling a preset large language model, and generating a code patch corresponding to the target page element based on the adjustment intention; Based on the code path, replacing the running code of the target page element with the code patch through an atomic write operation.
- 12. The page update method of claim 11, wherein said responding to said command line tool modifying said running code to present an updated target page based on said preview interface comprises: the command line tool sends the operation log corresponding to the atomic write operation to the browser IDE through the second channel; and loading the modified running code by the browser IDE based on the running log, triggering the target page to carry out hot update, and displaying the hot updated target page in the preview interface.
- 13. The page update method as recited in claim 12, wherein before the obtaining, based on the browser IDE, the target page element selected by the user and the adjustment instruction for the target page element, the method further comprises: the browser IDE sends a communication connection request to the command line tool through a preset loop back address; the command line tool generating an authentication token based on the communication connection request and sending the authentication token to the browser IDE; The browser IDE performs communication handshake verification with the command line tool based on the authentication token; and under the condition that the communication handshake verification is passed, establishing the first channel and the second channel between the browser IDE and the command line tool based on the preset loop back address.
- 14. The page update method of claim 13, wherein the method further comprises: and the command line tool injects a preset security request head into the access path or the running log before sending the access path or the running log to the browser IDE through the second channel.
- 15. The page updating device is applied to electronic equipment, wherein the electronic equipment is provided with a browser IDE and a command line tool, the browser IDE is in communication connection with the command line tool, the browser IDE comprises a preview interface, and the device comprises: the acquisition module is used for acquiring a target page element selected by a user and an adjustment instruction aiming at the target page element based on the browser IDE, and sending the adjustment instruction to the command line tool so that the command line tool modifies the running code of the target page element based on the adjustment instruction; And the updating module is used for responding to the modified running code of the command line tool and displaying the updated target page based on the preview interface.
- 16. An electronic device, the electronic device comprising: A memory for storing a computer program product; processor for executing a computer program product stored in the memory, which, when executed, implements the page updating method of any of the preceding claims 1 to 14.
- 17. A computer readable storage medium, characterized in that the computer readable storage medium has stored thereon computer program instructions which, when executed, implement the page updating method of any of the preceding claims 1 to 14.
Description
Page updating method and device Technical Field One or more embodiments of the present disclosure relate to the field of computer technologies, and in particular, to a method and an apparatus for updating a page. Background With the rapid development of information technology, digital products are gradually popularized, and the front-end page is used as a core carrier for interaction between various information systems and users, and is widely applied to various fields such as financial services, electronic commerce platforms, office systems, medical health and the like. At present, the scale and complexity of enterprise-level front-end projects are continuously improved, and higher technical requirements are provided for development efficiency of front-end pages, convenience in iterative updating, safety compliance and the like. In order to meet the actual requirements of efficient development and flexible iteration of the front-end page, optimize the operation experience of a developer, reduce the complexity of multi-link collaboration, and provide a front-end page updating scheme which is more efficient and more adaptive to an actual scene. Disclosure of Invention One or more embodiments of the present disclosure provide a method and apparatus for updating a page. In a first aspect, one or more embodiments of the present disclosure provide a page update method applied to an electronic device, where the electronic device is configured with a browser IDE and a command line tool, the browser IDE is communicatively connected to the command line tool, and the browser IDE includes a preview interface, and the method includes: based on the browser IDE, acquiring a target page element selected by a user and an adjustment instruction aiming at the target page element, and sending the adjustment instruction to the command line tool so that the command line tool modifies the running code of the target page element based on the adjustment instruction; and modifying the running code in response to the command line tool, and displaying an updated target page based on the preview interface. In one possible implementation manner, the obtaining the target page element selected by the user includes: acquiring a target page selected by a user; And acquiring the DOM element selected by the user on the target page, and taking the DOM element as the target page element. In one possible implementation manner, the browser IDE further comprises a navigation interface, and the obtaining the target page selected by the user comprises: Acquiring a page to be updated selected by a user through the navigation interface; Acquiring an access address of the page to be updated; And displaying the page to be updated on the preview interface based on the access address, and taking the page to be updated as the target page. In one possible implementation manner, the browser IDE is communicatively connected to the command line tool based on a dual channel, where the dual channel includes a first channel and a second channel, and the obtaining the access address of the page to be updated includes: the browser IDE sends the page to be updated selected by the user to the command line tool through the first channel; The command line tool generates a corresponding access address based on the running file path of the page to be updated, and sends the access address to the browser IDE through the second channel. In one possible implementation manner, the obtaining the DOM element selected by the user on the target page includes: adding DOM element interaction script to the target page; Detecting user interaction action based on the DOM element interaction script; and determining DOM elements selected by the user based on the interaction. In one possible implementation, the method further includes: adding labels for all DOM elements in the target page; the labels are associated with code paths of each DOM element, and the code paths are used for indicating positions of codes corresponding to the DOM elements in the running file of the target page. In one possible implementation manner, the acquiring an adjustment instruction for the target page element includes: acquiring an adjustment intention input by a user aiming at the target page element; the adjustment intent is packaged as the adjustment instruction. In one possible implementation manner, the obtaining the adjustment intention of the target page element input by the user includes: In response to a target page element selected by a user, an adjustment intent for the target page element entered by the user in text form or in speech form is received. In one possible implementation manner, the obtaining the adjustment intention of the target page element input by the user includes: responding to a target page element selected by a user, and displaying a configuration panel, wherein the configuration panel is provided with preset adjustment options or parameter adjustment controls matched with t