Vue-based universal component implementation method supporting recalendar date entry
By encapsulating the Hijri component in the Vue framework, the calculation and display of the Hijri calendar and the Gregorian calendar are realized, which solves the problem of date information collection errors caused by users' unfamiliarity with the Gregorian calendar during business processing, improves the efficiency and level of business processing, and satisfies the Hijri calendar date Choice needs.
Patent Information
- Application Number
- CN202410712523.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-04
- Publication Date
- 2024-09-17
AI Technical Summary
In some countries where the Hijri calendar is officially used, users are not familiar with the Gregorian calendar, which may cause date information collection errors, resulting in slow business processing. Moreover, existing component libraries that support Vue such as Element-UI do not support Hijri date selection, which cannot satisfy users. The need for date selection using the familiar Hijri calendar.
Provide a general component implementation method based on Vue. By encapsulating the Hijri component, create a Hijri calendar selection page, use JavaScript to perform calculations on the Hijri calendar and the Gregorian calendar, support the flexible selection of the Hijri calendar year, month and date, and convert the selected Hijri calendar date to the Gregorian calendar The date is passed to the parent page to realize the selection and display of Hijri dates.
This method simplifies the business processing operation, improves the efficiency and level of business processing, meets the user's demand for date selection using the familiar Hijri calendar, and optimizes the business processing process.
Smart Images

Figure CN118656069A
Abstract
Description
Technical Field
[0001] The invention discloses a method, and relates to the technical field of front-end components, in particular to a general component implementation method for supporting Hijri date entry based on Vue. Background Art
[0002] For some countries whose official calendar is the Hijri calendar, users of their digital systems may encounter problems such as incorrect date information collection and slow business processing due to their unfamiliarity with the Gregorian calendar when handling business. However, many open source component libraries that support Vue, such as Element-UI, do not support Hijri date selection, or cannot flexibly select years and months, and cannot complete the date conversion between the Gregorian calendar and the Hijri calendar, and cannot meet the user's operational needs of using the familiar Hijri calendar for date selection in real business scenarios. The Hijri calendar usually refers to the Islamic calendar. Summary of the invention
[0003] In view of the problems of the prior art, the present invention provides a general component implementation method based on Vue to support the entry of Hijri calendar dates, which encapsulates the Hijri calendar component and can meet the needs of users for selecting dates in the Hijri calendar when handling business, optimizes business handling operations, greatly improves business handling efficiency, and enhances the business handling level.
[0004] The specific scheme proposed by the present invention is:
[0005] The present invention provides a general component implementation method based on Vue to support Hijri date entry, builds a front-end application framework based on Vue, uses HTML and Element-UI component library to create a Hijri calendar selection page and encapsulates it as a Hijri component.
[0006] Reference the encapsulated Hijri component through the parent page, pass parameters, and call up the Hijri calendar selection page of the Hijri panel.
[0007] The Hijri calendar is displayed through the Hijri panel, in which JavaScript is used to perform Hijri and Gregorian calendar operations, calculate the day of the week corresponding to the first day of the month, obtain all the dates of the month and their corresponding days, and on the Hijri calendar selection page, pass the selected Hijri date and the converted Gregorian calendar date together to the parent page to echo the selected Hijri date.
[0008] Furthermore, in the general component implementation method based on Vue to support the entry of Hijri calendar date, the Hijri panel is designed through the Hijri component:
[0009] The month and year are displayed on the right side of the Hijri panel header. Click the month button on the right side, and the Hijri panel will display all the months. Click the year button to select a year.
[0010] There are shortcut buttons on the left side of the Hijri panel header. When the Hijri panel displays dates, click the shortcut buttons to display all dates of the previous month or the next month; when the Hijri panel displays months, click the shortcut buttons to display all months of the previous year or the next year; when the Hijri panel displays years, click the shortcut buttons to display the previous ten years or the next ten years.
[0011] Furthermore, the method for implementing a general component based on Vue to support Hijri date entry passes parameters through the parent page, including:
[0012] Pass the disabled attribute parameter, gregorianDate attribute parameter, hjriData attribute parameter, and afterDisable attribute parameter. Use the disabled attribute parameter to control whether the Hijri panel is open, use the gregorianDate attribute parameter to select the Gregorian date, use the hjriData attribute parameter to select the Hijri date, and use the afterDisable attribute parameter to limit date selection.
[0013] Furthermore, in the general component implementation method based on Vue that supports the entry of Hijri dates, a toParentDate callback method is provided through the Hijri component, and the selected Hijri date and the converted Gregorian date are passed to the parent page on the Hijri selection page through the toParentDate callback method.
[0014] The present invention also provides a general component implementation device based on Vue to support Hijri date entry, including a Hijri component management module, a calling module, a display module, a calculation module and a callback module.
[0015] The Hijri component management module builds a front-end application framework based on Vue, uses HTML and Element-UI's component library to create a Hijri calendar selection page and encapsulates it as a Hijri component.
[0016] The calling module references the encapsulated Hijri component through the parent page, passes parameters, and calls up the Hijri calendar selection page of the Hijri panel.
[0017] The display module displays the Hijri calendar through the Hijri panel, the calculation module performs Hijri and Gregorian calendar operations through JavaScript, calculates the day of the week corresponding to the first day of the month, and obtains all the dates of the month and their corresponding days. The callback module passes the selected Hijri date and the converted Gregorian date to the parent page on the Hijri calendar selection page to echo the selected Hijri date.
[0018] Furthermore, the Hijri component management module in the Vue-based general component implementation device supporting Hijri date entry designs the Hijri panel through the Hijri component:
[0019] The month and year are displayed on the right side of the Hijri panel header. Click the month button on the right side, and the Hijri panel will display all the months. Click the year button to select a year.
[0020] There are shortcut buttons on the left side of the Hijri panel header. When the Hijri panel displays dates, click the shortcut buttons to display all dates of the previous month or the next month; when the Hijri panel displays months, click the shortcut buttons to display all months of the previous year or the next year; when the Hijri panel displays years, click the shortcut buttons to display the previous ten years or the next ten years.
[0021] Furthermore, the calling module in the general component implementation device for supporting Hijri date entry based on Vue passes parameters through the parent page, including:
[0022] Pass the disabled attribute parameter, gregorianDate attribute parameter, hjriData attribute parameter, and afterDisable attribute parameter. Use the disabled attribute parameter to control whether the Hijri panel is open, use the gregorianDate attribute parameter to select the Gregorian date, use the hjriData attribute parameter to select the Hijri date, and use the afterDisable attribute parameter to limit date selection.
[0023] Furthermore, in the callback module of the general component implementation device based on Vue that supports the entry of Hijri dates, the toParentDate callback method is provided through the Hijri component, and the selected Hijri date and the converted Gregorian date are passed to the parent page on the Hijri selection page through the toParentDate callback method.
[0024] The benefits of the present invention are:
[0025] The present invention realizes a component that supports Hijri calendar selection, supports flexible selection of Hijri calendar year, month and date, supports conversion of selected Hijri calendar date into Gregorian calendar, and supports display of Gregorian calendar date and Hijri calendar date passed into the component. It can meet the needs of users to use the Hijri calendar they are familiar with to select dates when handling business, simplify and optimize the business handling operations of staff, greatly improve business handling efficiency, and enhance business handling level. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] 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 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.
[0027] Figure 1 It is a schematic flow chart of the method of the present invention.
[0028] Figure 2 It is a schematic diagram of a week corresponding interface involved in the present invention.
[0029] Figure 3 The present invention relates to a schematic diagram of a hijri month interface.
[0030] Figure 4 The present invention relates to a schematic diagram of a Hijri year interface.
[0031] Figure 5 The present invention relates to a schematic diagram of an interface between a selected Hijri date and a converted Gregorian date. DETAILED DESCRIPTION
[0032] Vue is a web front-end framework built on standard HTML, CSS and JavaScript. It is easy to learn and use, has excellent performance and is applicable to a wide range of scenarios. Use Vue.js to develop a cross-platform framework for all front-end applications. One set of code can be published to multiple platforms such as IOS, Android, and H5 at the same time.
[0033] The present invention is further described below in conjunction with the accompanying drawings and specific embodiments so that those skilled in the art can better understand the present invention and implement it, but the embodiments are not intended to limit the present invention.
[0034] Example 1
[0035] The present invention provides a general component implementation method based on Vue to support Hijri date entry, builds a front-end application framework based on Vue, uses HTML and Element-UI component library to create a Hijri calendar selection page and encapsulates it as a Hijri component.
[0036] Reference the encapsulated Hijri component through the parent page, pass parameters, and call up the Hijri calendar selection page of the Hijri panel.
[0037] The Hijri calendar is displayed through the Hijri panel, in which JavaScript is used to perform Hijri and Gregorian calendar operations, calculate the day of the week corresponding to the first day of the month, obtain all the dates of the month and their corresponding days, and on the Hijri calendar selection page, pass the selected Hijri date and the converted Gregorian calendar date together to the parent page to echo the selected Hijri date.
[0038] The method of the present invention builds a front-end application framework based on Vue, uses HTML, Element-UI component library, performs Hijri and Gregorian calendar operations through JavaScript, creates a Hijri calendar selection page and encapsulates it as a Hijri component. The parent page references the encapsulated Hijri component, can call up the Hijri calendar selection page, supports flexible selection of years, months, and dates, and supports fast selection of today's date; the Hijri calendar selection page can be hidden, and Hijri and Gregorian calendar date operations are performed, and the selected Hijri calendar date and the converted Gregorian calendar date are transmitted to the parent page together; and the selected Hijri calendar date is supported to be echoed.
[0039] Example 2
[0040] Based on Example 1, the method of the present invention can further design a Hijri panel through a Hijri component:
[0041] The month and year are displayed on the right side of the Hijri panel header. Click the month button on the right side, and the Hijri panel will display all the months. Click the year button to select a year.
[0042] There are shortcut buttons on the left side of the Hijri panel header. When the Hijri panel displays dates, click the shortcut buttons to display all dates of the previous month or the next month; when the Hijri panel displays months, click the shortcut buttons to display all months of the previous year or the next year; when the Hijri panel displays years, click the shortcut buttons to display the previous ten years or the next ten years.
[0043] And when passing parameters through the parent page, you can further include:
[0044] Pass the disabled attribute parameter, gregorianDate attribute parameter, hjriData attribute parameter, and afterDisable attribute parameter. The disabled attribute parameter is used to control whether the Hijri panel is opened, the Gregorian calendar date is selected by the gregorianDate attribute parameter, the Hijri calendar date is selected by the hjriData attribute parameter, and the date selection is restricted by the afterDisable attribute parameter. Please refer to Table 1 for details.
[0045] Table 1
[0046]
[0047] And the toParentDate callback method is provided by the Hijri component, and the selected Hijri date and the converted Gregorian date are passed to the parent page on the Hijri selection page through the toParentDate callback method. Please refer to Table 2.
[0048] Table 2
[0049]
[0050] The method of the present invention encapsulates an effective Hijri calendar component, which can meet the needs of users to use the Hijri calendar they are familiar with to select dates when handling business, simplifies and optimizes the business handling operations of staff, greatly improves business handling efficiency, and enhances business handling level.
[0051] Example 3
[0052] The present invention also provides a general component implementation device based on Vue to support Hijri date entry, including a Hijri component management module, a calling module, a display module, a calculation module and a callback module.
[0053] The Hijri component management module builds a front-end application framework based on Vue, uses HTML and Element-UI's component library to create a Hijri calendar selection page and encapsulates it as a Hijri component.
[0054] The calling module references the encapsulated Hijri component through the parent page, passes parameters, and calls up the Hijri calendar selection page of the Hijri panel.
[0055] The display module displays the Hijri calendar through the Hijri panel, the calculation module performs Hijri and Gregorian calendar operations through JavaScript, calculates the day of the week corresponding to the first day of the month, and obtains all the dates of the month and their corresponding days. The callback module passes the selected Hijri date and the converted Gregorian date to the parent page on the Hijri calendar selection page to echo the selected Hijri date.
[0056] As the information interaction, execution process and other contents between the modules in the above-mentioned device are based on the same concept as the embodiment of the method of the present invention, the specific contents can be found in the description of the embodiment of the method of the present invention and will not be repeated here.
[0057] Similarly, the device of the present invention realizes a component that supports Hijri calendar selection, supports flexible selection of Hijri calendar year, month and date, supports conversion of selected Hijri calendar date into Gregorian calendar, and supports display of Gregorian calendar date and Hijri calendar date passed into the component. It can meet the needs of users to use the Hijri calendar they are familiar with to select dates when handling business, simplify and optimize the business handling operations of staff, greatly improve business handling efficiency, and enhance business handling level.
[0058] It should be noted that not all steps and modules in the above-mentioned processes and device structures are necessary, and some steps or modules can be ignored according to actual needs. The execution order of each step is not fixed and can be adjusted as needed. The system structure described in the above-mentioned embodiments can be a physical structure or a logical structure, that is, some modules may be implemented by the same physical entity, or some modules may be implemented by multiple physical entities, or some components in multiple independent devices may be implemented together.
[0059] The above-described embodiments are only preferred embodiments for fully illustrating the present invention, and the protection scope of the present invention is not limited thereto. Equivalent substitutions or changes made by those skilled in the art based on the present invention are within the protection scope of the present invention. The protection scope of the present invention shall be subject to the claims.
Claims
1. A general component implementation method based on Vue to support Hijri date entry, characterized by Build a front-end application framework based on Vue, use HTML and Element-UI's component library to create a Hijri calendar selection page and encapsulate it as a Hijri component. Reference the encapsulated Hijri component through the parent page, pass parameters, and call up the Hijri calendar selection page of the Hijri panel. The Hijri calendar is displayed through the Hijri panel, in which JavaScript is used to perform Hijri and Gregorian calendar operations, calculate the day of the week corresponding to the first day of the month, obtain all the dates of the month and their corresponding days, and on the Hijri calendar selection page, pass the selected Hijri date and the converted Gregorian calendar date together to the parent page to echo the selected Hijri date.
2. According to claim 1, a general component implementation method based on Vue to support Hijri date entry is characterized by By using Hijri components, design the Hijri panel: The month and year are displayed on the right side of the Hijri panel header. Click the month button on the right side, and the Hijri panel will display all the months. Click the year button to select a year. There are shortcut buttons on the left side of the Hijri panel header. When the Hijri panel displays dates, click the shortcut buttons to display all dates of the previous month or the next month; when the Hijri panel displays months, click the shortcut buttons to display all months of the previous year or the next year; when the Hijri panel displays years, click the shortcut buttons to display the previous ten years or the next ten years.
3. According to claim 1, a general component implementation method based on Vue to support Hijri date entry is characterized in that Pass parameters through the parent page, including: Pass the disabled attribute parameter, gregorianDate attribute parameter, hjriData attribute parameter, and afterDisable attribute parameter. Use the disabled attribute parameter to control whether the Hijri panel is open, use the gregorianDate attribute parameter to select the Gregorian date, use the hjriData attribute parameter to select the Hijri date, and use the afterDisable attribute parameter to limit date selection.
4. According to claim 1, a general component implementation method based on Vue to support Hijri date entry is characterized in that The toParentDate callback method is provided by the Hijri component, and the selected Hijri date and the converted Gregorian date are passed to the parent page on the Hijri selection page through the toParentDate callback method.
5. A general component implementation device based on Vue to support Hijri date entry, characterized in that Including Hijri component management module, calling module, display module, calculation module and callback module, The Hijri component management module builds a front-end application framework based on Vue, uses HTML and Element-UI's component library to create a Hijri calendar selection page and encapsulates it as a Hijri component. The calling module references the encapsulated Hijri component through the parent page, passes parameters, and calls up the Hijri calendar selection page of the Hijri panel. The display module displays the Hijri calendar through the Hijri panel, the calculation module performs Hijri and Gregorian calendar operations through JavaScript, calculates the day of the week corresponding to the first day of the month, and obtains all the dates of the month and their corresponding days. The callback module passes the selected Hijri date and the converted Gregorian date to the parent page on the Hijri calendar selection page to echo the selected Hijri date.
6. A general component implementation device for supporting Hijri date entry based on Vue according to claim 5, characterized in that The Hijri component management module designs the Hijri panel through the Hijri component: The month and year are displayed on the right side of the Hijri panel header. Click the month button on the right side, and the Hijri panel will display all the months. Click the year button to select a year. There are shortcut buttons on the left side of the Hijri panel header. When the Hijri panel displays dates, click the shortcut buttons to display all dates of the previous month or the next month; when the Hijri panel displays months, click the shortcut buttons to display all months of the previous year or the next year; when the Hijri panel displays years, click the shortcut buttons to display the previous ten years or the next ten years.
7. A general component implementation device for supporting Hijri date entry based on Vue according to claim 5, characterized in that The calling module passes parameters through the parent page, including: Pass the disabled attribute parameter, gregorianDate attribute parameter, hjriData attribute parameter, and afterDisable attribute parameter. Use the disabled attribute parameter to control whether the Hijri panel is open, use the gregorianDate attribute parameter to select the Gregorian date, use the hjriData attribute parameter to select the Hijri date, and use the afterDisable attribute parameter to limit date selection.
8. A general component implementation device for supporting Hijri date entry based on Vue according to claim 5, characterized in that The callback module provides the toParentDate callback method through the Hijri component, and transmits the selected Hijri date and the converted Gregorian date to the parent page on the Hijri selection page through the toParentDate callback method.
