


[Compiled and shared] Some common Vue interview questions (with answer analysis)
This time I will share with you some common interview questions about Vue to help you sort out basic knowledge and enhance your Vue knowledge reserve. It is worth collecting, come and take a look!
Summary of common Vue interview questions
MVVM model?
MVVM is the abbreviation of Model-View-ViewModel
, which is essentially an upgraded version of the MVC
model. Among them, Model
represents the data model, View
represents the page seen, and ViewModel
is between View
and Model
Bridge, the data will be bound to the ViewModel
layer and automatically render the data into the page. When the view changes, the ViewModel
layer will be notified to update the data. In the past, the view was updated by operating DOM
, but now it is data-driven view
.
Vue’s life cycle
Each Vue component instance will go through a series of initialization processes after it is created. During this process, a function called a life cycle hook will be run. This gives users the opportunity to add their own code at specific stages.
The life cycle of Vue can be divided into 8 stages: before and after creation, before and after mounting, before and after updating, before and after destruction, as well as the life cycle of some special scenarios. Vue 3 also adds three new scenes for debugging and server-side rendering. [Related recommendations: vuejs video tutorial, web front-end development]
Life cycle in Vue 2 | Lifecycle in Vue 3 | Description |
---|---|---|
beforeCreate |
beforeCreate |
Before creation, the data of data and methods have not been initialized yet |
created |
created |
After creation, there is a value in data , but it has not been mounted yet. You can do some Ajax Request |
beforeMount |
beforeMount |
before mounting, the virtual DOM will be found , compiled into Render
|
mounted |
mounted |
After mounting, DOM has been created and can be used to obtain access data and DOM elements |
beforeUpdate |
beforeUpdate |
Before update, can be used to obtain various statuses before update |
updated | updated |
After updating, all statuses are up to date |
beforeDestroy |
beforeUnmount |
Can be used to cancel some timers or subscriptions before destruction |
destroyed |
unmounted |
After destruction, it can be used for the cancellation of some timers or subscriptions |
activated |
activated |
keep-alive When the cached component is activated |
deactivated |
deactivated |
keep-alive When the cached component is deactivated |
errorCaptured |
errorCaptured |
Called when capturing an error from a descendant component |
— | renderTracked |
Debug hook, called when reactive dependencies are collected |
— | renderTriggered |
Debug hook, called when reactive dependency is triggered |
— | serverPrefetch |
before the component instance is rendered on the server transfer |
Life cycle of parent and child components:
-
Loading and rendering phase
: parent beforeCreate -> parent created -> parent beforeMount - > child beforeCreate -> child created -> child beforeMount -> child mounted -> parent mounted -
Update phase
: parent beforeUpdate -> child beforeUpdate -> child updated -> parent updated -
Destruction phase
: parent beforeDestroy -> child beforeDestroy -> child destroyed -> parent destroyed
Vue.$nextTick
Execute a delayed callback after the next DOM update cycle. Use this method immediately after modifying data to get the updated DOM.
nextTick
is a global API provided by Vue. Due to Vue's asynchronous update strategy, our data modifications will not be directly reflected in the DOM. At this time, if you want To immediately obtain the updated DOM state, you need to use this method.
Vue executes asynchronously when updating the DOM. When data changes, Vue will open an asynchronous update queue and buffer all data changes that occur in the same event loop. If the same watcher
is triggered multiple times, it will only be pushed into the queue once. This deduplication during buffering is important to avoid unnecessary calculations and DOM operations. The nextTick
method will add a callback function to the queue to ensure that the function is called only after the previous DOM operation is completed.
Usage scenarios:
If you want to get the updated
DOM
structure immediately after modifying the data, you can useVue.nextTick ()
Perform
DOM
operations in thecreated
life cycle
##What happens during the Vue instance mounting process?
The mounting process refers to theapp.mount() process. This is an initialization process. It does two things as a whole:
Initialization and
Establish an update mechanism.
patchConvert
vnode to
dom ; At the same time, executing the rendering function for the first time will create a dependency between its internal responsive data and the component update function, so that when the data changes in the future, the corresponding update function will be executed.
Vue’s template compilation principle
There is a unique compiler module in Vue calledcompiler. Its main function is to compile users The written
template is compiled into an executable
render function in js.
In Vue, the compiler will first parse
template, this step is called
parse, and after the end, a JS object will be obtained, which is called
abstract syntax tree AST; Then there is the conversion process of deep processing of
AST, this step is called
transform, and finally the
AST obtained previously is generated into JS code, also It’s the
render function.
Vue’s responsiveness principle
- The data responsiveness in Vue 2 will be processed differently according to the data type. If it is an object, intercept object property access through
Object.defineProperty(obj,key,descriptor)
. When the data is accessed or changed, sense and react; if it is an array, overwrite the array prototype. method, extending its seven change methods (push, pop, shift, unshift, splice, sort, reverse) so that these methods can additionally perform update notifications and respond.
Disadvantages:- Recursive traversal during initialization will cause performance loss;
- The notification update process requires maintaining a large number of
- dep
instances and
watcherInstance, it takes up a lot of additional memory;
Adding or deleting object properties cannot be intercepted, and requires APIs such as - Vue.set
and
deleteto take effect;
The newly generated - Map
and
Setdata structures in
ES6are not supported.
- Vue 3 uses the
Proxy
mechanism of
ES6to proxy data that needs to be responsive. It can support objects and arrays at the same time. Dynamic attribute additions and deletions can be intercepted. All new data structures are supported. Object nested attributes are recursive at runtime and are proxied only when used. There is no need to maintain a particularly large number of dependencies, and the performance has been greatly improved. Big progress.
Virtual DOM
- Concept:
Virtual DOM, as the name suggests, is a virtual DOM object, which itself is A JS object just describes a view structure through different attributes.
Benefits of virtual DOM:
(1) Performance improvement
There are limitations to directly operating the DOM. There are many attributes on a real element. If you operate it directly, it will A lot of extra attribute content is manipulated, which is unnecessary. If these operations are transferred to JS objects, it will be much simpler. In addition, operating the DOM is relatively expensive, and frequent DOM operations can easily cause page redrawing and reflow. If intermediate processing is performed through abstract VNode, the number of direct DOM operations can be effectively reduced, thereby reducing page redrawing and reflow.
(2) Convenient cross-platform implementation
The same VNode node can be rendered into corresponding content on different platforms. For example: when rendered in the browser, it is a DOM element node, and when rendered in Native (iOS, Android) it becomes the corresponding control. . Vue 3 allows developers to implement custom renderers based on VNode to facilitate rendering for different platforms.Structure:
There is no unified standard, generally includingtag
,props
,children
Three items.tag
: required. It's a label, or it can be a component, or a function.props
: Optional. It's the properties and methods on this label.children
: Optional. It is the content or child nodes of this tag. If it is a text node, it is a string; if it has child nodes, it is an array. In other words, ifchildren
is judged to be a string, it means that it must be a text node, and this node must have no child elements.
diff algorithm
1. Concept:
diff
The algorithm is a Comparison algorithm, by comparing the old virtual DOM and the new virtual DOM, we can find out which virtual node has changed. Find this virtual node and only update the real node corresponding to this virtual node without updating other unchanged nodes. Node to accurately update the real DOM, thus improving efficiency.
2. Comparison method:
diff
The overall strategy of the algorithm is: Depth first, same layer comparison
. Comparisons will only be performed at the same level, and will not be compared across levels; during the comparison process, the loop will shrink from both sides to the middle.
- First determine whether the
tag
of the two nodes are the same. If they are different, delete the node and recreate the node for replacement. -
tag
When they are the same, replace the attributes first, and then compare the sub-elements, which are divided into the following situations:- When the old and new nodes have sub-elements, use the double pointer method comparing. Compare the old and new head and tail pointers, loop closer to the middle, call
patchVnode
according to the situation,patch
repeat the process, callcreateElem
to create a new node, and create a new node from the hash table Find thekey
consistentVNode
node and then operate according to the situation. - The new node has child elements, and the old node has no child elements. Just convert the virtual node of the child element into a real node and insert it.
- The new node has no child elements, and the old node has child elements, then the child elements are cleared and set to the text content of the new node.
- When the old and new nodes have no child elements, that is, they are both text nodes, the text content will be compared directly, and if they are different, they will be updated.
- When the old and new nodes have sub-elements, use the double pointer method comparing. Compare the old and new head and tail pointers, loop closer to the middle, call
#What is the role of key in Vue?
key
is mainly used to update the virtual DOM
more efficiently.
When Vue determines whether two nodes are the same, it mainly determines the key
and element type tag
of the two nodes. Therefore, if key
is not set, its value is undefined, and it may always be considered that these are two identical nodes, and only update operations can be performed, which will cause a large number of DOM update operations.
Why is the data in the component a function?
In new Vue(), it can be a function or an object, because there is only one root instance and no data pollution will occur.
In the component, data must be a function. The purpose is to prevent multiple component instance objects from sharing the same data and causing data pollution. In the form of a function, it will be returned as a factory function when initData is used. Brand new data object.
How to communicate between components in Vue?
-
Communication between parent and child components:
The parent passes data to the child through
props
, and the child passes data to the parent through$emit
Trigger events; communication can also be done through the parent chain/child chain ($parent
/$children
);ref
You can also access component instances;provide
/inject
;$attrs
/$listeners
. -
Sister component communication:
Global event bus
EventBus
,Vuex
. -
Cross-level component communication:
Global event bus
EventBus
,Vuex
,provide
/inject
.
What is the difference between v-show and v-if?
The control methods are different.
v-show
is by adding the css attributedisplay: none
to the element, but the element still exists; whilev-if
controls the display or hiding of the element by changing the entire element Add or delete.The compilation process is different.
v-if
Switching has a partial compilation/uninstallation process. During the switching process, internal event listeners and sub-components are properly destroyed and rebuilt;v-show
is just a simple css-based switching.The compilation conditions are different.
v-if
is a true conditional rendering. It will ensure that event listeners and subcomponents within the conditional block are properly destroyed and rebuilt during the switching process. When the rendering condition is false, no operation will be performed until Render for the sake of truth.The trigger life cycle is different.
v-show
When changing from false to true, the life cycle of the component will not be triggered;v-if
When changing from false to true, the component'sbeforeCreate## will be triggered. #,
created,
beforeMount,
mountedhooks trigger the component's
beforeDestory,
destoryed# when changing from true to false. ##hook. Performance consumption is different. - v-if
has a higher switching cost;
v-show
has a higher initial rendering cost. Usage scenarios:
v-show
, such as: accordion menu, tab page, etc.;
If the conditions rarely change during runtime, it is better to use v-if
. For example, after the user logs in, different content will be displayed according to different permissions.
- computed
- Computed properties rely on other properties to calculate values. Changes in any internal dependencies will re-execute the function. Computed properties are cached and can be reused multiple times. When calculating attributes, the return value will be obtained from the cache. The calculated attributes must have the
return
keyword. watch - Listen to changes in certain data to trigger the function. When the data is an object type, you need to use the deep listening
deep
attribute when the attribute value in the object changes. You can also use the immediate listeningimmdiate
attribute when the page is first loaded. Application scenarios:
In Vue 2,
v-for has a higher priority than v-if
, which means v-if
will Repeatedly run in each v-for
loop. If the array to be traversed is large and the actual data to be displayed is very small, it will cause a huge waste of performance. In Vue 3, it is exactly the opposite.
has a higher priority than v-for
, so when v-if
is executed , the variable it calls does not exist yet and will cause an exception. There are usually two situations that lead to this:
- v-for = "user in users" v-if = "user.active"
- . In this case, you can define a calculated property and let it return the filtered list.
In order to avoid rendering the list that should be hidden, such as
v-for = "user in users" v-if = "showUsersFlag" - . In this case, you can move
v-if
to the container element or wrap it with a layer oftemplate
.
You can manually add responsive data to solve the problem of data change views not being updated. When you directly set the value of an item in the array or directly set the value of a property of the object in the project, you will find that the page is not updated. This is because of the limitations of
Object.defineProperty(), which cannot monitor data changes. You can use this.$set(array or object, array subscript or object’s property name, updated value )
solve. <h3 id="strong-What-is-keep-alive-strong"><strong>What is keep-alive? </strong></h3>
<ul>
<li>Function: Implement component caching, maintain component status, and avoid performance problems caused by repeated rendering. </li>
<li>Working principle: Vue.js internally abstracts DOM nodes into individual VNode nodes. <code>keep-alive
The cache of components is also based on VNode nodes. It caches components that meet the conditions in the cache object, and when re-rendering, the VNode node is taken out of the cache object and rendered.
①
include
: string or regular, only components with matching names will be cached. ②
exclude
: String or regular expression, any component with a matching name will not be cached. ③
max
: Number, the maximum number of component instances that can be cached. Matching first checks the
name
option of the component. If the name
option is not available, it matches its local registration name (the key value of the parent component components option). Anonymous components cannot be match. Components with keep-alive
cached will have two more life cycle hooks: activated
, deactivated
.
When entering the component for the first time: beforeCreate --> created --> beforeMount --> mounted --> activated --> beforeUpdate --> updated --> deactivated
Enter the component again It provides A very flexible way to distribute reusable functionality in Vue components.
Usage scenarios: Some identical or similar codes are often used in different components, and the functions of these codes are relatively independent. The same or similar code can be extracted through mixins. Disadvantages:
Unclear variable source
Multiple mixins may cause naming conflicts (solution: Vue 3 Combination API)
There are multiple pairs of relationships between mixin and component pits, making the project more complex.
- Slot
- slot The slot is generally used inside the component. When encapsulating the component, it is not used inside the component. When determining what form of element is displayed in this position, you can occupy this position through
. The element at this position needs to be passed in the form of content from the parent component. slot is divided into:
##Default slot
: Subcomponents use the <slot>
tag to determine the rendering position, label You can put the DOM
structure inside as backup content. When the parent component is in use, you can directly write content in the tag of the child component, and this part of the content will be inserted into the
- Tag position. If the parent component is used without passing content to the slot, the backing content will be displayed on the page.
-
Named slot
: The subcomponent uses the
nameattribute to represent the name of the slot. If the slot does not specify
name, there will be a hidden The included name is
default . When used in the parent component, the - v-slot
directive is used to specify which slot the element needs to be placed in based on the default slot. The
v-slotvalue is the child component slot
nameAttribute value. Use the
v-slotdirective to specify which slot the element is placed in. It must match the
element, and one
element can only correspond to A reserved slot, that is, multiple
elements cannot use the
v-slotdirective to specify the same slot. The abbreviation of
v-slotis
#. For example,
v-slot:headercan be abbreviated as
#header.
Scope slot
: The subcomponent binds
propsdata on the
<slot>tag to pass the subcomponent data to Used by the parent component. Method for parent component to obtain slot binding props data:
-
scope="received variable name":
slot-scope="received variable name":-
v-slot: slot name="received variable name": -
#What are the modifiers in Vue?
In Vue, modifiers handle many details of DOM events, so that we no longer need to spend a lot of time dealing with these troublesome things, and can have more energy to focus on the program. Logical processing. Modifiers in Vue are divided into the following types: Form modifier
lazy
After filling in the information, the value will be assigned to value only when the cursor leaves the label, that is,change
Information synchronization is performed after the event.number
Automatically converts the user input value into a numeric type, but if the value cannot be parsed byparseFloat
, the original value will be returned.trim
Automatically filter the first and last spaces entered by the user, while the spaces in the middle will not be filtered.Event modifier
stop
prevents event bubbling, which is equivalent to calling theevent.stopPropagation
method.prevent
Prevents the default behavior of the event, which is equivalent to calling theevent.preventDefault
method.self
The handler function is only triggered whenevent.target
is the current element itself.once
After the event is bound, it can only be triggered once, and it will not be triggered the second time.capture
Use the event capture mode, that is, events triggered by the element itself are processed here first, and then handed over to internal elements for processing.passive
Tell the browser that you don't want to block the default behavior of the event.native
Let the component listen to the native events of the root element like thehtml
built-in tag. Otherwise, usingv-on
on the component will only listen to custom events. event.Mouse button modifier
left
Left click.right
Right click.middle
Middle click.-
Key value modifier
Keyboard modifier is used to modify keyboard events (onkeyup
,onkeydown
), There are as follows:keyCode
There are many, butvue
provides us with aliases, which are divided into the following two types:- Common keys (enter, tab, delete , space, esc, up...)
- System modifier keys (ctrl, alt, meta, shift...)
Concept:
SPA (Single-page application)
, that is, single-page application, which is a model of a network application or website , interact with the user by dynamically rewriting the current page. This method avoids interrupting the user experience when switching between pages. InSPA
, all necessary code (HTML, JavaScript, and CSS) is retrieved through the load of a single page, or appropriate resources are dynamically loaded and added to the page as needed (usually in response to user actions). The page does not reload at any point in time, nor does control transfer to other pages. For example, just like a cup, it contains milk in the morning, coffee at noon, and tea in the afternoon. It always has the content and the cup remains unchanged. The difference between-
SPA
andMPA
:MPA (Muti-page application)
, that is, multi-page application. InMPA
, each page is a main page and is independent. Whenever a page is accessed, the Html, CSS, and JS files need to be reloaded, and public files are loaded on demand. . ##SPAMPA One main page and multiple page fragments Multiple main pages hash mode history mode Difficult to implement, can be improved by using SSR method Easy to implement Easy Transfer through url, cookie, localStorage, etc. Fast speed , Good user experience Switching loading resources, slow speed, poor user experience Relatively easy Relatively complex SPA
Advantages and Disadvantages:
Advantages:- has the immediacy of desktop applications, the portability of websites and Accessibility
- The user experience is good and fast, and content changes do not require reloading the entire page
- Good front-end and back-end separation, clearer division of labor
Disadvantages:
- Not conducive to search engine crawling
- The first rendering speed is relatively slow
Two-way binding?
Concept:
Two-way binding in Vue is a directivev-model
, which can bind a responsive data to the view, while the view Changes in can change this value.v-model
is syntactic sugar. By default, it is equivalent to:value
and@input
. Usingv-model
can reduce a lot of tediousness. event handling code to improve development efficiency.Usage:
Usually used on form itemsv-model
, and can also be used on custom components to represent the input and output of a certain value control.Principle:
v-model
is an instruction. Two-way binding is actually done by the Vue compiler, and the output containsv -The component rendering function of the model
template is actually the binding of thevalue
attribute and theinput
event monitoring. The corresponding variable update operation will be performed in the event callback function.
# Can a child component directly change the data of the parent component?
All
prop
follow the single binding principle,props
changes due to the update of the parent component, and will naturally New state flows down to child components and not backwards. This prevents child components from accidentally modifying the parent component's state, otherwise the application's data flow would easily become confusing and difficult to understand.
In addition, every time the parent component is updated, theprops
in all child components will be updated to the latest value, which means that aprop## should not be modified in the child component. #, if you do this, Vue will throw a warning on the console.
- In the actual development process, there are usually two scenarios that lead to the need to modify
prop
:
- prop
is used Because the initial value is passed in, and the child component wants to use it as a local data property later. In this case, it is best to define a new local data attribute and get the initial value from
props.
Needs further conversion on the incoming - prop
value. It's better to define a computed property based on that
propvalue.
- prop
- In practice, if you really want to change the properties of the parent component, you should
emit
An event to let the parent component change. When an object or array is passed in as
props, although the child component cannot change the
propsbinding, it can still
change the value inside the object or array. This is because JS objects and arrays are passed by reference, and for Vue, although it is possible to prohibit such changes, it will cause a huge performance loss, and the gain outweighs the gain.
1. Hash mode: The value of
- location.hash
- is the thing after # in the url. Its characteristic is that although the hash appears in the URL, it will not be included in the HTTP request and has no impact on the backend at all, so changing the hash will not reload the page.
You can add listening events for hash changes
window.addEventListener("hashchange", funcRef, false) - , every time it changes
hash (window.location.hash)
, will add a record to the browser's access history. Using the above characteristics of hash, you can realize the function offront-end routing updating the view but not re-requesting the page
. Features: Good compatibility but not beautiful
2. History mode:
Use the new
pushState()## in HTML5 History Interface # andreplaceState()
method.
These two methods are applied to the browser's history stack. Based on the currently existingback
,
forward,
go, they provide The function of modifying historical records has been added.
These two methods have one thing in common: when they are called to modify the browser history stack, although the current url has changed, the browser will not refresh the page. This causes the problem of "updating the view but not updating the view" for single-page application front-end routing. "Re-request page" provides basicfeatures: although it is beautiful, 404 will appear when refreshing and requires back-end configuration.
Dynamic routing?
Many times, we need to map routes for a given matching pattern to the same component. In this case, we need to define dynamic routing. For example, we have a User component, which must be used to render all users with different IDs. Then, we can use
dynamic path parameters (dynamic segment)
in the routing path of vue-router to achieve this effect:{path: '/user/:id', compenent: User}
, where:id
is the dynamic path parameter.Understanding of Vuex?
Concept:
Vuex is a state management library dedicated to Vue. It centrally manages the state of the application in a global manner and uses corresponding rules to ensure that the state is maintained in a reliable manner. The way forecasting changes.Problems solved:
The main problem Vuex solves is state sharing between multiple components. Although state sharing can also be achieved using various communication methods, it is often necessary to maintain state consistency among multiple components. This model is prone to problems and complicates program logic. Vuex extracts the shared state of components and manages it in a global singleton mode, so that any component can obtain and modify the state in a consistent way. Responsive data can also ensure simple one-way flow, making the code more efficient. Structured and easy to maintain.When to use:
Vuex is not necessary, it can manage state, but it also brings more concepts and frameworks. If we do not plan to develop a large single-page application or there is not a large amount of global state to maintain in the application, there is no need to use Vuex. A simple store mode is enough. Otherwise, Vuex would be the natural choice.Usage:
Vuex puts the global state into thestate
object, which itself is a state tree, andstore## is used in the component.
#stateof the instance accesses these states; then uses the matching
mutationmethod to modify these states, and can only use
mutationto modify the state and call ## in the component #commit
Method submissionmutation
; If there are asynchronous operations or complex logical combinations in the application, you need to writeaction
. After execution, if there are state modifications, you still need to submitmutation
, the component dispatchesaction
throughdispatch
. The last step is modularization. Use themodules
option to organize the split sub-modules. When accessing the state, you need to add the name of the sub-module. If the sub-module has settingsnamespace
, then additional namespace prefixes are required when submittingmutation
and dispatchingaction
.
Vuex only saves the state in memory and will be lost after refreshing. If you want to persist, you need to save it.
localStorageis very suitable. When submitting
vuex-persistmutation
, it will be stored inlocalStorage
and the value will be retrieved instore
Just use it as the initial value ofstate
.You can also use third-party plug-ins. It is recommended to use the
plug-in. It is a plug-in for Vuex persistent storage and does not require you to manually access
Understanding about Vue SSR?storage
, but save the state directly tocookie
orlocalStorage
.SSR
is
Server Side Render (Server Side Render)
, which is to complete the work of Vue rendering tags into html on the client side on the server side. , and then return the html directly to the client.<ul> <li>Advantages: <br>Has better SEO, and the first screen loads faster. </li> <li>Disadvantages: <br>Development conditions will be limited. Server-side rendering only supports two hooks, beforeCreate and created. When we need some external extension libraries, special processing is required. Server-side rendering applications also need to be in Node. .js running environment. The server will have greater load requirements. </li> </ul> <h3 id="strong-What-do-you-know-about-Vue-s-performance-optimization-methods-strong"><strong>What do you know about Vue’s performance optimization methods? </strong></h3> <ul> <li>Lazy loading of routes. Effectively split the application size and load it asynchronously when accessed. </li> <li> <code>keep-alive
Cache the page. Avoid duplicate creation of component instances and retain cached component state.v-for
Traversal avoids usingv-if
at the same time. In fact, it is already a wrong usage in Vue 3.- Long list performance optimization, virtual list can be used.
v-once
. Usev-once
for data that no longer changes.- Event destruction. After the component is destroyed, global variables and timers are destroyed.
- Images are lazy loaded.
- Third-party plug-ins are introduced on demand.
- Sub-component splitting. Heavier state components are suitable for splitting.
- Server-side rendering.
(Learning video sharing: vuejs introductory tutorial, Basic programming video)
Yes SPA understanding?
-
The above is the detailed content of [Compiled and shared] Some common Vue interview questions (with answer analysis). For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Foreword: In the development of vue3, reactive provides a method to implement responsive data. This is a frequently used API in daily development. In this article, the author will explore its internal operating mechanism.

Ace is an embeddable code editor written in JavaScript. It matches the functionality and performance of native editors like Sublime, Vim, and TextMate. It can be easily embedded into any web page and JavaScript application. Ace is maintained as the main editor for the Cloud9 IDE and is the successor to the Mozilla Skywriter (Bespin) project.

Vue.js has become a very popular framework in front-end development today. As Vue.js continues to evolve, unit testing is becoming more and more important. Today we’ll explore how to write unit tests in Vue.js 3 and provide some best practices and common problems and solutions.

When using the Vue framework to develop front-end projects, we will deploy multiple environments when deploying. Often the interface domain names called by development, testing and online environments are different. How can we make the distinction? That is using environment variables and patterns.

When I was working on the chatgpt mirror site, I found that some mirror sites did not have typewriter cursor effects, but only text output. Did they not want to do it? I want to do it anyway. So I studied it carefully and realized the effect of typewriter plus cursor. Now I will share my solution and renderings~

Since the release of Vue3, the word composition API has entered the field of vision of students who write Vue. I believe everyone has always heard how much better the composition API is than the previous options API. Now, due to the release of the @vue/composition-api plug-in, Vue2 Students can also get on the bus. Next, we will mainly use responsive ref and reactive to conduct an in-depth analysis of how this plug-in achieves this.

When we used Amap, the official recommended many cases and demos to us, but these cases all used native methods to access and did not provide demos of vue or react. Many people have written about vue2 access on the Internet. However, in this article, we will take a look at how vue3 uses the commonly used Amap API. I hope it will be helpful to everyone!

In the actual development project process, sometimes it is necessary to upload relatively large files, and then the upload will be relatively slow, so the background may require the front-end to upload file slices. It is very simple. For example, 1 A gigabyte file stream is cut into several small file streams, and then the interface is requested to deliver the small file streams respectively.
