How eric202501/hw-sd3 works
Based on your file tree and README, the project “NCU Map” is a single-page Vue.js application meant to provide a landmark search experience using a map canvas. The three main functions (searching, displaying markers, and showing details) are implemented as separate Vue components, with data (in JSON format) stored under the assets folder.
Main Components
• Frontend Framework: Highlight Vue.js as the main framework, and also list Bootstrap for the CSS styling.
• Entry Point: The index.html file which loads the application.
• Core Application: The “src” folder where the App.vue serves as the root component.
• Components:
• SearchBar: Handles text input. (see src/components/SearchBar.vue)
• MapCanvas: Responsible for rendering the map and displaying search results/markers. (see src/components/MapCanvas.vue)
• ButtonMenu or other supporting components: (e.g., ButtonMenu.vue) which may be used for filtering or categorized searches.
• Data Assets: The JSON files under src/assets (data.json and data2.json) that store landmark information.
• Build/Dev Tool: Vite (configured in vite.config.js) which is used to bundle and serve the application.
Relationships/Interactions
• User Interaction: A user’s input via the SearchBar (text input “this.searchInput”) triggers the search functionality.
• Data Flow:
• The SearchBar communicates (likely via Vue events or props) the search query.
• Processed results are then passed to the MapCanvas via a function call (e.g., showResult(result)).
• The MapCanvas uses the landmark “name” property from the JSON data to display markers; clicking on markers might trigger a detail view.
• Another component (implied by showDetail(name)) is responsible for showing the detailed information for a selected landmark.
Architectural Patterns/Design Principles
• Component-Based Architecture: Emphasize that the application is built as individual, reusable Vue components.
• Frontend-Only Architecture: This is a client-side application; there is no separate back-end service noted.
• Separation of Concerns: Clearly separate UI (search input, map canvas) from data (assets) and styling (Bootstrap, CSS files in src/main.css).
Elements
• From the User Browser to the SearchBar (user input).
• From SearchBar to MapCanvas (transfer of the search result array).
• From MapCanvas to Detail Display Component (on landmark selection).
• A listing of technologies/frameworks next to each component, e.g., “Vue.js”, “Bootstrap”, “Vite”.