# 组件化

# Web Components

# lib

# webpack

自动引入 (opens new window)

function importAll(requireContext) {
  requireContext.keys().forEach(path => {
    let component = requireContext(path)
    component = component.default || component
    Vue.component(component.name, component)
  })
}

const requireContextFilter = require.context('./filter', false, /\.vue$/)
const requireContextComponents = require.context('./components', false, /\.vue$/)
importAll(requireContextFilter)
importAll(requireContextComponents)
1
2
3
4
5
6
7
8
9
10
11
12
Last Updated: 8/13/2022, 9:22:45 PM