Vue main.js 文件中全局组件注册部分

在 \src\components\index.js 文件中export组件

import HeaderList from './HeaderList'
import HeaderMenu from './HeaderMenu'
import HeaderPatient from './HeaderPatient'
import ExitUser from './ExitUser'
import TreePanel from './VueTree'
import TreeTable from './pc/TreeTable'

import TinymceText from './Tinymce'

export default {
    HeaderList,
    HeaderMenu,
    HeaderPatient,
    ExitUser,
    TreePanel,
    TreeTable,
    TinymceText,
}

main.js中修改如下:

import components from './components/' //加载公共组件
Object.keys(components).forEach((key)=>{
  var name = key.toString()
  Vue.component(name,components[key])
})

 

你可能感兴趣的:(vue实战)