# Vue

# 安装

  • 命令行代理设置
set http_proxy=http://web-proxy.oa.com:8080

# webpack

# 组件化

  1. 功能模块 - select, pagenation
  2. 页面区域 - header, footer, sidebar

# 拆分组件实时渲染

The runtime-only build does not include the template compiler, and does not support the template option.
You can only use the render option when using the runtime-only

# 遇到问题

Failed to mount component: template or render function not defined

如果将 import Vue from 'vue' 改为自己路径 vue.js 错误消失,就证明是统一个问题,应该引用的版本不包括 template 渲染模版。 只需要在 webpack.config.js

resolve: {
  extensions: ['.js', '.vue'],
  alias: {
    filter: path.join(__dirname, './src/filters'),
    components: path.join(__dirname, './src/components'),
    vue$: 'vue/dist/vue.common.js'
  }
}

# 事件监听时,切忌使用大写,页面会监听不到

  • 错误
handleCancle: function() {
  console.log('handleCancel')
  this.$emit('Cancel')
}

<new-project v-if="pages.newProject" v-on:Cancel="hideNewProject"></new-project>
  • 正确
handleCancle: function() {
  console.log('handleCancel')
  this.$emit('cancel')
}

<new-project v-if="pages.newProject" v-on:Cancel="hideNewProject"></new-project>

# 相关站点

官方论坛 (opens new window)

Last Updated: 5/14/2022, 11:38:45 AM