Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

能否提供一个 es6 的 module 用来 import ? #42

Open
giiska opened this issue May 11, 2017 · 5 comments
Open

能否提供一个 es6 的 module 用来 import ? #42

giiska opened this issue May 11, 2017 · 5 comments

Comments

@giiska
Copy link

giiska commented May 11, 2017

现在你把 install 合在一起的,不能只 import directive,不方便扩展。

@MeCKodo
Copy link
Owner

MeCKodo commented May 11, 2017

可以说说是怎样的拓展吗?现在还不太明白

@giiska
Copy link
Author

giiska commented May 11, 2017

比如

import Vue from 'vue'
import { vTapOnlyDirective } from 'vue-tap'
const vTapExtended = dosomething(vTapExtended)
Vue.directive('vTap', vTapExtended)

或者我只想某个 single component file 用这个 directive 的时候。

@giiska
Copy link
Author

giiska commented May 11, 2017

类似

import VueTap from './VueTap'

export function install (Vue) {
  Vue.directive('tap', VueTap)
}

export {
  VueTap
}

/* -- Plugin definition & Auto-install -- */
/* You shouldn't have to modify the code below */

// Plugin
const plugin = {
  /* eslint-disable no-undef */
  version: VERSION,
  install,
}

export default plugin

// Auto-install
let GlobalVue = null
if (typeof window !== 'undefined') {
  GlobalVue = window.Vue
} else if (typeof global !== 'undefined') {
  GlobalVue = global.Vue
}
if (GlobalVue) {
  GlobalVue.use(plugin)
}

Copied from https://github.com/Akryum/vue-share-components

@giiska
Copy link
Author

giiska commented May 11, 2017

可以把 vue1 vue2 版本的都 export 出来,方便 webpack2 做 tree-shaking。

@MeCKodo
Copy link
Owner

MeCKodo commented May 15, 2017

分别export是可以,不过本身也没多大,tree也少不了多少K。拓展的话,就一个tap指令有什么需要拓展的么?有什么需要,还不如我开放个配置接口更方便

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants