찾다
웹 프론트엔드View.jsVue 인스턴스를 마운트하는 방법은 무엇입니까? 인스턴스 마운팅 과정에 대해 이야기해보겠습니다.

Vue 인스턴스를 어떻게 마운트하나요? 다음 문서에서는 Vue 인스턴스를 마운트하는 과정을 안내합니다. 도움이 되기를 바랍니다.

Vue 인스턴스를 마운트하는 방법은 무엇입니까? 인스턴스 마운팅 과정에 대해 이야기해보겠습니다.

Vue2는 오랫동안 대중의 주목을 받았고, 심지어 Vue3도 사용하게 되었습니다. 대형 제조업체를 만나고 싶지 않더라도 누구나 Vue2에 대한 숙달을 점차 심화시켜야 합니다. 소스 코드 수준에 도달하도록 노력해야 합니다. Vue 인스턴스의 마운트 과정은 인터뷰에서 자주 등장하는 테스트 포인트입니다. 오늘은 소스코드를 기반으로 차근차근 분석해보도록 하겠습니다! (학습 영상 공유: vuejs 튜토리얼)

1. 생각하기

우리 모두는 Know what it is, Know Why 라는 말을 들어봤습니다.

이 프로세스에서 new Vue()가 정확히 무엇을 하는지 생각해 본 적이 있는지 궁금합니다. new Vue()这个过程中究竟做了些什么?

过程中是如何完成数据的绑定,又是如何将数据渲染到视图的等等。

二、分析

首先找到Vue的构造函数

源码位置: src/core/instance/index.js

function Vue (options) {
  if (process.env.NODE_ENV !== 'production' &&
    !(this instanceof Vue)
  ) {
    warn('Vue is a constructor and should be called with the `new` keyword')
  }
  this._init(options)
}

options是用户传递过来的配置项,如data、methods等常用的方法。

Vue构建函数调用_init方法,但我们发现本文件中并没有此方法,但仔细可以看到文件下方定义了很多初始化方法。

initMixin(Vue);     // 定义 _init
stateMixin(Vue);    // 定义 $set $get $delete $watch 等
eventsMixin(Vue);   // 定义事件  $on  $once $off $emit
lifecycleMixin(Vue);// 定义 _update  $forceUpdate  $destroy
renderMixin(Vue);   // 定义 _render 返回虚拟dom

首先可以看到initMixin方法,发现该方法在Vue原型上定义了_init方法。

源码位置: src/core/instance/init.js

Vue.prototype._init = function (options?: Object) {
    const vm: Component = this
    // a uid
    vm._uid = uid++
    let startTag, endTag
    /* istanbul ignore if */
    if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
      startTag = `vue-perf-start:${vm._uid}`
      endTag = `vue-perf-end:${vm._uid}`
      mark(startTag)
    }

    // a flag to avoid this being observed
    vm._isVue = true
    // merge options
    // 合并属性,判断初始化的是否是组件,这里合并主要是 mixins 或 extends 的方法
    if (options && options._isComponent) {
      // optimize internal component instantiation
      // since dynamic options merging is pretty slow, and none of the
      // internal component options needs special treatment.
      initInternalComponent(vm, options)
    } else { // 合并vue属性
      vm.$options = mergeOptions(
        resolveConstructorOptions(vm.constructor),
        options || {},
        vm
      )
    }
    /* istanbul ignore else */
    if (process.env.NODE_ENV !== 'production') {
      // 初始化proxy拦截器
      initProxy(vm)
    } else {
      vm._renderProxy = vm
    }
    // expose real self
    vm._self = vm
    // 初始化组件生命周期标志位
    initLifecycle(vm)
    // 初始化组件事件侦听
    initEvents(vm)
    // 初始化渲染方法
    initRender(vm)
    callHook(vm, 'beforeCreate')
    // 初始化依赖注入内容,在初始化data、props之前
    initInjections(vm) // resolve injections before data/props
    // 初始化props/data/method/watch/methods
    initState(vm)
    initProvide(vm) // resolve provide after data/props
    callHook(vm, 'created')

    /* istanbul ignore if */
    if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
      vm._name = formatComponentName(vm, false)
      mark(endTag)
      measure(`vue ${vm._name} init`, startTag, endTag)
    }
    // 挂载元素
    if (vm.$options.el) {
      vm.$mount(vm.$options.el)
    }
  }

仔细阅读上面的代码,我们得到以下的结论:

  • 在调用beforeCreate之前,数据初始化并未完成,像dataprops这些属性无法访问到
  • 到了created的时候,数据已经初始化完成,能够访问到dataprops这些属性,但这时候并未完成dom的挂载,因此无法访问到dom元素。
  • 挂载方法是调用vm.$mount方法

initState方法是完成 props/data/method/watch/methods的初始化。

源码位置:src/core/instance/state.js

export function initState (vm: Component) {
  // 初始化组件的watcher列表
  vm._watchers = []
  const opts = vm.$options
  // 初始化props
  if (opts.props) initProps(vm, opts.props)
  // 初始化methods方法
  if (opts.methods) initMethods(vm, opts.methods)
  if (opts.data) {
    // 初始化data  
    initData(vm)
  } else {
    observe(vm._data = {}, true /* asRootData */)
  }
  if (opts.computed) initComputed(vm, opts.computed)
  if (opts.watch && opts.watch !== nativeWatch) {
    initWatch(vm, opts.watch)
  }
}

我们在这里主要看初始化data的方法为initData,它与initState在同一文件上

function initData (vm: Component) {
  let data = vm.$options.data
  // 获取到组件上的data
  data = vm._data = typeof data === 'function'
    ? getData(data, vm)
    : data || {}
  if (!isPlainObject(data)) {
    data = {}
    process.env.NODE_ENV !== 'production' && warn(
      'data functions should return an object:\n' +
      'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
      vm
    )
  }
  // proxy data on instance
  const keys = Object.keys(data)
  const props = vm.$options.props
  const methods = vm.$options.methods
  let i = keys.length
  while (i--) {
    const key = keys[i]
    if (process.env.NODE_ENV !== 'production') {
      // 属性名不能与方法名重复
      if (methods && hasOwn(methods, key)) {
        warn(
          `Method "${key}" has already been defined as a data property.`,
          vm
        )
      }
    }
    // 属性名不能与state名称重复
    if (props && hasOwn(props, key)) {
      process.env.NODE_ENV !== 'production' && warn(
        `The data property "${key}" is already declared as a prop. ` +
        `Use prop default value instead.`,
        vm
      )
    } else if (!isReserved(key)) { // 验证key值的合法性
      // 将_data中的数据挂载到组件vm上,这样就可以通过this.xxx访问到组件上的数据
      proxy(vm, `_data`, key)
    }
  }
  // observe data
  // 响应式监听data是数据的变化
  observe(data, true /* asRootData */)
}

仔细阅读上面的代码,我们可以得到以下结论:

  • 初始化顺序:propsmethodsdata
  • data
  • 이 과정에서 데이터 바인딩을 완료하는 방법, 데이터를 뷰에 렌더링하는 방법 등이 있습니다.

vm.$mount方法

源码:

Vue.prototype.$mount = function (
  el?: string | Element,
  hydrating?: boolean
): Component {
  // 获取或查询元素
  el = el && query(el)

  /* istanbul ignore if */
  // vue 不允许直接挂载到body或页面文档上
  if (el === document.body || el === document.documentElement) {
    process.env.NODE_ENV !== 'production' && warn(
      `Do not mount Vue to <html> or <body> - mount to normal elements instead.`
    )
    return this
  }

  const options = this.$options
  // resolve template/el and convert to render function
  if (!options.render) {
    let template = options.template
    // 存在template模板,解析vue模板文件
    if (template) {
      if (typeof template === &#39;string&#39;) {
        if (template.charAt(0) === &#39;#&#39;) {
          template = idToTemplate(template)
          /* istanbul ignore if */
          if (process.env.NODE_ENV !== &#39;production&#39; && !template) {
            warn(
              `Template element not found or is empty: ${options.template}`,
              this
            )
          }
        }
      } else if (template.nodeType) {
        template = template.innerHTML
      } else {
        if (process.env.NODE_ENV !== &#39;production&#39;) {
          warn(&#39;invalid template option:&#39; + template, this)
        }
        return this
      }
    } else if (el) {
      // 通过选择器获取元素内容
      template = getOuterHTML(el)
    }
    if (template) {
      /* istanbul ignore if */
      if (process.env.NODE_ENV !== &#39;production&#39; && config.performance && mark) {
        mark(&#39;compile&#39;)
      }
      /**
       *  1.将temmplate解析ast tree
       *  2.将ast tree转换成render语法字符串
       *  3.生成render方法
       */
      const { render, staticRenderFns } = compileToFunctions(template, {
        outputSourceRange: process.env.NODE_ENV !== &#39;production&#39;,
        shouldDecodeNewlines,
        shouldDecodeNewlinesForHref,
        delimiters: options.delimiters,
        comments: options.comments
      }, this)
      options.render = render
      options.staticRenderFns = staticRenderFns

      /* istanbul ignore if */
      if (process.env.NODE_ENV !== &#39;production&#39; && config.performance && mark) {
        mark(&#39;compile end&#39;)
        measure(`vue ${this._name} compile`, &#39;compile&#39;, &#39;compile end&#39;)
      }
    }
  }
  return mount.call(this, el, hydrating)
}

阅读上面代码,我们能得到以下结论:

  • 不要将根元素放到body或者html
  • 可以在对象中定义template/render或者直接使用templateel表示元素选择器
  • 最终都会解析成render函数,调用compileToFunctions,会将template解析成render函数

template的解析步骤大致分为以下几步:

  • html文档片段解析成ast描述符
  • ast描述符解析成字符串
  • 生成render函数

生成render函数,挂载到vm上后,会再次调用mount方法

源码位置:src/platforms/web/runtime/index.js

// public mount method
Vue.prototype.$mount = function (
  el?: string | Element,
  hydrating?: boolean
): Component {
  el = el && inBrowser ? query(el) : undefined
  // 渲染组件
  return mountComponent(this, el, hydrating)
}

调用mountComponent渲染组件

export function mountComponent (
  vm: Component,
  el: ?Element,
  hydrating?: boolean
): Component {
  vm.$el = el
  // 如果没有获取解析的render函数,则会抛出警告
  // render是解析模板文件生成的
  if (!vm.$options.render) {
    vm.$options.render = createEmptyVNode
    if (process.env.NODE_ENV !== &#39;production&#39;) {
      /* istanbul ignore if */
      if ((vm.$options.template && vm.$options.template.charAt(0) !== &#39;#&#39;) ||
        vm.$options.el || el) {
        warn(
          &#39;You are using the runtime-only build of Vue where the template &#39; +
          &#39;compiler is not available. Either pre-compile the templates into &#39; +
          &#39;render functions, or use the compiler-included build.&#39;,
          vm
        )
      } else {
        // 没有获取到vue的模板文件
        warn(
          &#39;Failed to mount component: template or render function not defined.&#39;,
          vm
        )
      }
    }
  }
  // 执行beforeMount钩子
  callHook(vm, &#39;beforeMount&#39;)

  let updateComponent
  /* istanbul ignore if */
  if (process.env.NODE_ENV !== &#39;production&#39; && config.performance && mark) {
    updateComponent = () => {
      const name = vm._name
      const id = vm._uid
      const startTag = `vue-perf-start:${id}`
      const endTag = `vue-perf-end:${id}`

      mark(startTag)
      const vnode = vm._render()
      mark(endTag)
      measure(`vue ${name} render`, startTag, endTag)

      mark(startTag)
      vm._update(vnode, hydrating)
      mark(endTag)
      measure(`vue ${name} patch`, startTag, endTag)
    }
  } else {
    // 定义更新函数
    updateComponent = () => {
      // 实际调⽤是在lifeCycleMixin中定义的_update和renderMixin中定义的_render
      vm._update(vm._render(), hydrating)
    }
  }
  // we set this to vm._watcher inside the watcher&#39;s constructor
  // since the watcher&#39;s initial patch may call $forceUpdate (e.g. inside child
  // component&#39;s mounted hook), which relies on vm._watcher being already defined
  // 监听当前组件状态,当有数据变化时,更新组件
  new Watcher(vm, updateComponent, noop, {
    before () {
      if (vm._isMounted && !vm._isDestroyed) {
        // 数据更新引发的组件更新
        callHook(vm, &#39;beforeUpdate&#39;)
      }
    }
  }, true /* isRenderWatcher */)
  hydrating = false

  // manually mounted instance, call mounted on self
  // mounted is called for render-created child components in its inserted hook
  if (vm.$vnode == null) {
    vm._isMounted = true
    callHook(vm, &#39;mounted&#39;)
  }
  return vm
}

阅读上面代码,我们得到以下结论:

  • 会触发beforeCreate钩子
  • 定义updateComponent渲染页面视图的方法
  • 监听组件数据,一旦发生变化,触发beforeUpdate生命钩子

updateComponent方法主要执行在vue初始化时声明的render, update方法

render的作用主要是生成vnode

源码位置:src/core/instance/render.js

// 定义vue 原型上的render方法
Vue.prototype._render = function (): VNode {
    const vm: Component = this
    // render函数来自于组件的option
    const { render, _parentVnode } = vm.$options

    if (_parentVnode) {
        vm.$scopedSlots = normalizeScopedSlots(
            _parentVnode.data.scopedSlots,
            vm.$slots,
            vm.$scopedSlots
        )
    }

    // set parent vnode. this allows render functions to have access
    // to the data on the placeholder node.
    vm.$vnode = _parentVnode
    // render self
    let vnode
    try {
        // There&#39;s no need to maintain a stack because all render fns are called
        // separately from one another. Nested component&#39;s render fns are called
        // when parent component is patched.
        currentRenderingInstance = vm
        // 调用render方法,自己的独特的render方法, 传入createElement参数,生成vNode
        vnode = render.call(vm._renderProxy, vm.$createElement)
    } catch (e) {
        handleError(e, vm, `render`)
        // return error render result,
        // or previous vnode to prevent render error causing blank component
        /* istanbul ignore else */
        if (process.env.NODE_ENV !== &#39;production&#39; && vm.$options.renderError) {
            try {
                vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e)
            } catch (e) {
                handleError(e, vm, `renderError`)
                vnode = vm._vnode
            }
        } else {
            vnode = vm._vnode
        }
    } finally {
        currentRenderingInstance = null
    }
    // if the returned array contains only a single node, allow it
    if (Array.isArray(vnode) && vnode.length === 1) {
        vnode = vnode[0]
    }
    // return empty vnode in case the render function errored out
    if (!(vnode instanceof VNode)) {
        if (process.env.NODE_ENV !== &#39;production&#39; && Array.isArray(vnode)) {
            warn(
                &#39;Multiple root nodes returned from render function. Render function &#39; +
                &#39;should return a single root node.&#39;,
                vm
            )
        }
        vnode = createEmptyVNode()
    }
    // set parent
    vnode.parent = _parentVnode
    return vnode
}

_update主要功能是调用patch,将vnode转成为真实DOM,并且更新到页面中

源码位置:src/core/instance/lifecycle.js2. 분석

🎜🎜먼저 Vue의 생성자를 찾습니다🎜🎜소스 코드 위치: src/core/instance/index.js🎜
Vue.prototype._update = function (vnode: VNode, hydrating?: boolean) {
    const vm: Component = this
    const prevEl = vm.$el
    const prevVnode = vm._vnode
    // 设置当前激活的作用域
    const restoreActiveInstance = setActiveInstance(vm)
    vm._vnode = vnode
    // Vue.prototype.__patch__ is injected in entry points
    // based on the rendering backend used.
    if (!prevVnode) {
      // initial render
      // 执行具体的挂载逻辑
      vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */)
    } else {
      // updates
      vm.$el = vm.__patch__(prevVnode, vnode)
    }
    restoreActiveInstance()
    // update __vue__ reference
    if (prevEl) {
      prevEl.__vue__ = null
    }
    if (vm.$el) {
      vm.$el.__vue__ = vm
    }
    // if parent is an HOC, update its $el as well
    if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
      vm.$parent.$el = vm.$el
    }
    // updated hook is called by the scheduler to ensure that children are
    // updated in a parent&#39;s updated hook.
  }
🎜 옵션 데이터, 메소드 및 기타 일반적으로 사용되는 메소드와 같이 사용자가 전달하는 구성 항목입니다. 🎜🎜Vue 생성 함수는 _init 메서드를 호출하는데 이 파일에는 이 메서드가 존재하지 않는 것을 발견했지만, 자세히 살펴보면 파일 하단에 정의된 많은 초기화 방법. 🎜rrreee🎜먼저 initMixin 메서드를 볼 수 있고 이 메서드가 Vue 프로토타입의 _init 메서드를 정의한다는 것을 알 수 있습니다. 🎜🎜소스 코드 위치: src/core/instance/init.js🎜rrreee🎜위 코드를 주의 깊게 읽으면 다음과 같은 결론을 얻을 수 있습니다. 🎜
  • beforeCreate를 호출한 후 이전에는 데이터 초기화가 완료되지 않았으며 data, props 등의 속성에 접근할 수 없습니다🎜
  • 생성) >에 도달하면 데이터가 초기화되었으며 dataprops 속성에 액세스할 수 있습니다. 그러나 dom 마운트가 완료되지 않았습니다. 현재로서는 dom 요소에 액세스할 수 없습니다. 🎜
  • 마운팅 방법은 vm.$mount 메서드를 호출하는 것입니다. 🎜🎜🎜initState 메서드는 props/data/method/watch/를 완료하는 것입니다. 메소드초기화. 🎜🎜소스 코드 위치: src/core/instance/state.js🎜rrreee🎜여기서 주로 data를 초기화하는 방법인 initData를 살펴보겠습니다. code>입니다. initState🎜rrreee🎜와 동일한 파일에 있습니다. 위 코드를 주의 깊게 읽으면 다음과 같은 결론을 얻을 수 있습니다.🎜
    • 초기화 순서: props code>, <code>methods, data🎜
    • data를 정의할 때 함수 형식 또는 개체 형식을 선택할 수 있습니다(구성 요소는 함수에만 있을 수 있음). form)🎜🎜🎜데이터에 대하여 여기서는 응답성을 자세히 표시하지 않습니다. 위에서 언급했듯이 마운팅 방법은 vm.$mount 메서드를 호출하는 것입니다. 🎜🎜소스 코드: 🎜rrreee🎜위 코드를 읽으면 다음과 같은 결론을 얻을 수 있습니다. 🎜
      • 루트 요소를 넣지 마세요. body 또는 html🎜
      • 로 이동하세요. 개체에 template/render를 정의하거나 를 사용할 수 있습니다. >template를 직접 사용합니다. el은 요소 선택기 🎜
      • 가 결국 render 함수로 구문 분석된다는 의미입니다. 템플릿렌더링 함수로 구문 분석합니다. 🎜🎜🎜템플릿을 구문 분석하는 단계는 대략 다음 단계로 나뉩니다. 🎜
        • html 문서 조각을 파싱하여 ast 설명자로 파싱🎜
        • ast 설명자를 문자열로 파싱🎜
        • 렌더 생성 함수🎜🎜🎜render 함수를 생성하고 vm에 마운트한 후 mount 메서드를 다시 호출합니다🎜🎜소스 코드 위치: src/platforms/web/runtime/index.js🎜rrreee🎜mountComponent를 호출하여 구성 요소를 렌더링합니다🎜rrreee🎜위 코드를 읽으면 다음과 같은 결론을 얻을 수 있습니다. 🎜
        • beforeCreate code>Hook을 트리거합니다🎜<li>페이지 보기를 렌더링하기 위해 <code>updateComponent 메소드를 정의합니다🎜
        • 구성요소 데이터를 듣고 한 번 변경 사항이 있으면 beforeUpdate 라이프 후크를 트리거하세요🎜🎜🎜 updateComponent 메서드는 주로 renderupdate 메서드를 실행합니다 🎜🎜 vue 초기화 중에 선언된 render 주요 기능은 vnode🎜🎜소스 코드 위치: src/core/instance/render를 생성하는 것입니다. js🎜rrreee🎜_update주요 기능은 patch를 호출하고 vnode를 실제 DOM으로 변환하는 것입니다. , 페이지🎜🎜소스 코드 위치: src/core/instance/lifecycle.js 🎜로 업데이트하세요.
          Vue.prototype._update = function (vnode: VNode, hydrating?: boolean) {
              const vm: Component = this
              const prevEl = vm.$el
              const prevVnode = vm._vnode
              // 设置当前激活的作用域
              const restoreActiveInstance = setActiveInstance(vm)
              vm._vnode = vnode
              // Vue.prototype.__patch__ is injected in entry points
              // based on the rendering backend used.
              if (!prevVnode) {
                // initial render
                // 执行具体的挂载逻辑
                vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */)
              } else {
                // updates
                vm.$el = vm.__patch__(prevVnode, vnode)
              }
              restoreActiveInstance()
              // update __vue__ reference
              if (prevEl) {
                prevEl.__vue__ = null
              }
              if (vm.$el) {
                vm.$el.__vue__ = vm
              }
              // if parent is an HOC, update its $el as well
              if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
                vm.$parent.$el = vm.$el
              }
              // updated hook is called by the scheduler to ensure that children are
              // updated in a parent&#39;s updated hook.
            }

          三、结论

          • new Vue的时候会调用_init方法
            • 定义$set$get$delete$watch等方法
            • 定义$on$off$emit$off等事件
            • 定义_update$forceUpdate$destory生命周期
          • 调用$mount进行页面的挂载
          • 挂载的时候主要是通过mountComponent方法
          • 定义updateComponent更新函数
          • 执行render生成虚拟DOM
          • _update将虚拟DOM生成真实DOM结构,并且渲染到页面中

          (学习视频分享:web前端开发编程入门

위 내용은 Vue 인스턴스를 마운트하는 방법은 무엇입니까? 인스턴스 마운팅 과정에 대해 이야기해보겠습니다.의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

성명
이 기사는 掘金社区에서 복제됩니다. 침해가 있는 경우 admin@php.cn으로 문의하시기 바랍니다. 삭제
vue.js and React의 미래 : 트렌드와 예측vue.js and React의 미래 : 트렌드와 예측May 09, 2025 am 12:12 AM

vue.js 및 React의 미래 추세와 예측은 다음과 같습니다. 1) vue.js는 엔터프라이즈 레벨 애플리케이션에서 널리 사용되며 서버 측 렌더링 및 정적 사이트 생성에서 획기적인 결과를 얻었습니다. 2) RECT는 서버 구성 요소 및 데이터 수집에서 혁신하고 동시성 모델을 더욱 최적화합니다.

Netflix의 프론트 엔드 : 기술 스택에 대한 깊은 다이빙Netflix의 프론트 엔드 : 기술 스택에 대한 깊은 다이빙May 08, 2025 am 12:11 AM

Netflix의 프론트 엔드 기술 스택은 주로 React 및 Redux를 기반으로합니다. 1. 반응은 고성능 단일 페이지 응용 프로그램을 구축하는 데 사용되며 구성 요소 개발을 통해 코드 재사용 성 및 유지 보수를 향상시킵니다. 2. Redux는 상태 변경이 예측 가능하고 추적 할 수 있도록 국가 관리에 사용됩니다. 3. 도구 체인에는 코드 품질과 성능을 보장하기위한 웹 팩, 바벨, 농담 및 효소가 포함됩니다. 4. 성능 최적화는 코드 세분화, 게으른로드 및 서버 측 렌더링을 통해 사용자 경험을 향상시킵니다.

vue.js 및 프론트 엔드 : 대화식 사용자 인터페이스 구축vue.js 및 프론트 엔드 : 대화식 사용자 인터페이스 구축May 06, 2025 am 12:02 AM

vue.js는 대화 형 사용자 인터페이스를 구축하는 데 적합한 점진적인 프레임 워크입니다. 핵심 기능에는 응답 시스템, 구성 요소 개발 및 라우팅 관리가 포함됩니다. 1) 응답 시스템은 Object.DefineProperty 또는 프록시를 통한 데이터 모니터링을 실현하고 인터페이스를 자동으로 업데이트합니다. 2) 구성 요소 개발을 통해 인터페이스를 재사용 가능한 모듈로 분할 할 수 있습니다. 3) Vuerouter는 단일 페이지 응용 프로그램을 지원하여 사용자 경험을 향상시킵니다.

vuejs의 단점은 무엇입니까?vuejs의 단점은 무엇입니까?May 05, 2025 am 12:06 AM

vue.js의 주요 단점은 다음과 같습니다. 1. 생태계는 비교적 새롭고 타사 라이브러리와 도구는 다른 프레임 워크만큼 풍부하지 않습니다. 2. 학습 곡선은 복잡한 기능에서 가파르게됩니다. 3. 지역 사회 지원과 자원은 반응과 각도만큼 광범위하지 않다. 4. 대규모 응용 프로그램에서 성능 문제가 발생할 수 있습니다. 5. 버전 업그레이드 및 호환성 문제가 더 큽니다.

Netflix : 프론트 엔드 프레임 워크를 공개합니다Netflix : 프론트 엔드 프레임 워크를 공개합니다May 04, 2025 am 12:16 AM

Netflix는 React를 프론트 엔드 프레임 워크로 사용합니다. 1. 반응의 구성 요소 개발 및 가상 DOM 메커니즘은 성능 및 개발 효율성을 향상시킵니다. 2. Webpack 및 Babel을 사용하여 코드 구성 및 배포를 최적화하십시오. 3. 성능 최적화를 위해 코드 세분화, 서버 측 렌더링 및 캐싱 전략을 사용하십시오.

vue.js의 프론트 엔드 개발 : 장점과 기술vue.js의 프론트 엔드 개발 : 장점과 기술May 03, 2025 am 12:02 AM

vue.js의 인기에는 단순성과 쉬운 학습, 유연성 및 고성능이 포함됩니다. 1) Progressive Framework 설계는 초보자가 단계별로 학습하는 데 적합합니다. 2) 구성 요소 기반 개발은 코드 유지 관리 및 팀 협업 효율성을 향상시킵니다. 3) 반응 형 시스템과 가상 DOM은 렌더링 성능을 향상시킵니다.

vue.js vs. React : 사용 편의성 및 학습 곡선vue.js vs. React : 사용 편의성 및 학습 곡선May 02, 2025 am 12:13 AM

vue.js는 사용하기 쉽고 부드러운 학습 곡선이 있으며 초보자에게 적합합니다. React는 더 가파른 학습 곡선을 가지고 있지만 유연성이 강하기 때문에 숙련 된 개발자에게 적합합니다. 1. vue.js는 간단한 데이터 바인딩 및 프로그레시브 디자인을 통해 쉽게 시작할 수 있습니다. 2. 반응은 Virtual DOM 및 JSX에 대한 이해가 필요하지만 유연성과 성능 이점이 높아집니다.

vue.js vs. React : 어떤 프레임 워크가 당신에게 적합합니까?vue.js vs. React : 어떤 프레임 워크가 당신에게 적합합니까?May 01, 2025 am 12:21 AM

Vue.js는 빠른 개발 및 소규모 프로젝트에 적합한 반면 React는 크고 복잡한 프로젝트에 더 적합합니다. 1.vue.js는 간단하고 배우기 쉽고 빠른 개발 및 소규모 프로젝트에 적합합니다. 2. 반응은 강력하고 크고 복잡한 프로젝트에 적합합니다. 3. vue.js의 진보적 인 특징은 점차적으로 기능을 도입하는 데 적합합니다. 4. React의 구성 요소 및 가상 DOM은 복잡한 UI 및 데이터 집약적 인 응용 프로그램을 처리 할 때 잘 수행됩니다.

See all articles

핫 AI 도구

Undresser.AI Undress

Undresser.AI Undress

사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover

AI Clothes Remover

사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool

Undress AI Tool

무료로 이미지를 벗다

Clothoff.io

Clothoff.io

AI 옷 제거제

Video Face Swap

Video Face Swap

완전히 무료인 AI 얼굴 교환 도구를 사용하여 모든 비디오의 얼굴을 쉽게 바꾸세요!

뜨거운 도구

안전한 시험 브라우저

안전한 시험 브라우저

안전한 시험 브라우저는 온라인 시험을 안전하게 치르기 위한 보안 브라우저 환경입니다. 이 소프트웨어는 모든 컴퓨터를 안전한 워크스테이션으로 바꿔줍니다. 이는 모든 유틸리티에 대한 액세스를 제어하고 학생들이 승인되지 않은 리소스를 사용하는 것을 방지합니다.

SublimeText3 Mac 버전

SublimeText3 Mac 버전

신 수준의 코드 편집 소프트웨어(SublimeText3)

mPDF

mPDF

mPDF는 UTF-8로 인코딩된 HTML에서 PDF 파일을 생성할 수 있는 PHP 라이브러리입니다. 원저자인 Ian Back은 자신의 웹 사이트에서 "즉시" PDF 파일을 출력하고 다양한 언어를 처리하기 위해 mPDF를 작성했습니다. HTML2FPDF와 같은 원본 스크립트보다 유니코드 글꼴을 사용할 때 속도가 느리고 더 큰 파일을 생성하지만 CSS 스타일 등을 지원하고 많은 개선 사항이 있습니다. RTL(아랍어, 히브리어), CJK(중국어, 일본어, 한국어)를 포함한 거의 모든 언어를 지원합니다. 중첩된 블록 수준 요소(예: P, DIV)를 지원합니다.

메모장++7.3.1

메모장++7.3.1

사용하기 쉬운 무료 코드 편집기

WebStorm Mac 버전

WebStorm Mac 버전

유용한 JavaScript 개발 도구