fritx / vue-at

At.js for Vue.
https://fritx.github.io/vue-at/
MIT License
529 stars 114 forks source link

怎么在nuxt引入vue-at #110

Open 86driver opened 5 years ago

86driver commented 5 years ago

请问一下怎么在nuxt中引入vue-at

86driver commented 5 years ago

已解决

fritx commented 5 years ago

@86driver 有遇到什么困难吗 解决方式可否分享一下 😺

86driver commented 5 years ago

@86driver 有遇到什么困难吗 解决方式可否分享一下 😺

问题是报window undefined 在引入的时候判断一下就ok了: 如下 const At = process.browser ? require("vue-at") : undefined;

但是我现在碰到一个问题, 就是 @at方法 在我键入@键的时候不执行, 而是点击弹出的内容之后执行, 这个问题是我操作方法不对吗? 我尝试自己全局监听键盘按下, 但是有一个问题是 中文输入法的情况下 keyCode总是229 请问有没有什么办法解决我这个问题, 急 ~~

86driver commented 5 years ago

我找到我按@不触发的原因是 if (!keep && chunk.length > 0) { this.$emit("at", chunk); } 这句代码 chunk.length条件不符合 我该怎么做- -

amdp commented 4 years ago

Hi I'd like to use vue-at with nuxt, how did you solve the window undefined problem?

86driver commented 4 years ago

i I'd like to use vue-at with nuxt, how did you solve the window undefined proble

maybe you can use require instead of import like this: const At = process.browser ? require("vue-at") : undefined;

or you can deploy vue-at in vue.config.js like this: module.exports = { plugins: [{ src: '~/plugins/vue-at', ssr: false }] }

amdp commented 4 years ago

This does not work:

<template>
  <at :members="members">
    <div contenteditable></div>
  </at>
</template>

<script>
const At = process.browser ? require('vue-at') : undefined

export default {
  components: { At },
  data() {
    return {
      members: ['Roxie Miles', 'grace.carroll', '小浩'],
    }
  },
}
</script>

This:

at.js:

import Vue from 'vue'
import At from 'vue-at'

Vue.use(At)

nuxt.config.js:

...
  plugins: [{ src: '~/plugins/at.js', ssr: false }],
...

doesn't work either...

86driver commented 4 years ago

or you can clone vue-at at your own project and delete the useless code. the error maybe in vue.runtime.js&&vue.runtime.min.js

amdp commented 4 years ago

can you be more explicit/verbose?

Thank you, Alessandro Merletti De Palo https://amdp.me

Il lun 24 ago 2020, 14:16 86driver notifications@github.com ha scritto:

or you can clone vue-at at your own project and delete the uselesscode. the error maybe in vue.runtime.js&&vue.runtime.min.js

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/fritx/vue-at/issues/110#issuecomment-679091249, or unsubscribe https://github.com/notifications/unsubscribe-auth/AASEKG5O7P7THJ2F3HI5UHLSCJKZTANCNFSM4IXYGUQQ .