ui.js 773 字节
Newer Older
1 2 3 4 5
import Vue from 'vue'

// 使用白名单过滤(前期有一批自定义组件使用了 uni-)
import tags from 'uni-helpers/tags'

fxy060608's avatar
fxy060608 已提交
6 7 8 9
import 'uni-core/view/index.css'

import uni from './ui-api.js'

10 11
const oldIsReservedTag = Vue.config.isReservedTag

fxy060608's avatar
fxy060608 已提交
12 13
global.uni = uni

14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
Vue.config.isReservedTag = function (tag) {
  return tags.indexOf(tag) !== -1 || oldIsReservedTag(tag)
}

Vue.config.ignoredElements = tags

const oldGetTagNamespace = Vue.config.getTagNamespace

const conflictTags = ['switch', 'image', 'text', 'view']

Vue.config.getTagNamespace = function (tag) {
  if (~conflictTags.indexOf(tag)) { // svg 部分标签名称与 uni 标签冲突
    return false
  }
  return oldGetTagNamespace(tag) || false
}
fxy060608's avatar
fxy060608 已提交
30

31
require('uni-components')