fritx / vue-at

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

Undefined #3

Open jameswragg opened 7 years ago

jameswragg commented 7 years ago

Trying to implement the example & getting a simple undefined as the output in the browser.

Inspecting the DOM I can see:

<div class="atwho-wrap"><!----> undefined</div>
jameswragg commented 7 years ago

(Vue v2.1.8)

fritx commented 7 years ago

Ah.. 😕 Could you post your example code?

I guess it's about the <slot>? Maybe the undefined is output by the slot part. Did you pass any slot inside <at>? 😕

jameswragg commented 7 years ago

I just copied this example from the readme into a At.vue file in my project:

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

<script>
import At from 'vue-at'

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

Then implemented in my project with:

<template>
 <div>
   ...other markup...
   <at-editor></at-editor>
 </div>
</template>
<script>
import AtEditor from './AtEditor.vue'
export default {
    components: {
        AtEditor,
        ...
<script>
fritx commented 7 years ago

@jameswragg thanks for your reporting!

When I upgraded vue from 2.1.6 to 2.1.8, the bug occurs too. I found a related issue: https://github.com/vuejs/vue/issues/4581

While they said the patch has been included in 2.1.8, we still have the problem 😕 You could rollback to 2.1.6 and wait for some new fix. https://github.com/wffranco/vue-strap/issues/32#issuecomment-269886881

bukinoshita commented 7 years ago

I'm getting this too 😢

0xDing commented 7 years ago

The bug seems persisted in 2.1.10 🤕

0xDing commented 7 years ago

just need rebuild

    // It's work.
    import At from 'vue-at/src/At.vue'
fritx commented 7 years ago

@borisding1994 Oh, god, I should rebuild the package to republish?? I didn't know. I was thinking that it was Vue that should do updates.

fritx commented 7 years ago

I'm getting this too 😢

@bukinoshita it's a sad story, let me fix the bug arround.

It's work.

@borisding1994 what's your exact Vue version when you find it to work? Maybe I need to rebuild and publish.

fritx commented 7 years ago

I've just published vue-at@2.0.3 with some bug fixes in Backlog(#2), actually it includes a new feature (custom template).

And it works fine with me, when vue is 2.1.6. 😥

XavRsl commented 7 years ago

Hi @fritx ! Sorry but I still get the same error using 2.1.10. Is there anything I could do to make it work ?

Thanks

Xavier

0xDing commented 7 years ago

@fritx work at 2.1.10.

May be related to this:

Vue v2.1.7 Change logs If you are the author of a plugin/component that ships a pre-compiled dist file:

It is recommended to re-compile the dist file using the latest versions of vue-template-compiler and vue-template-es2015-compiler. The new generated code is backwards-compatible, but code generated by older versions of the compilers may not work properly with the latest runtime.

Code generation changes that affect compatibility are very rare and we will avoid introducing similar changes in future patch releases.

fritx commented 7 years ago

@borisding1994 thanks for pointing it out! nice! I've managed to reproduce you guys' "undefined" problem, and solved it by bumping the minor versions of vue loaders and compilers.

-    "vue-loader": "^10.0.0",
+    "vue-loader": "^10.3.0",
      "vue-style-loader": "^1.0.0",
-    "vue-template-compiler": "^2.1.0",
+    "vue-template-compiler": "^2.2.4",

Published as vue-at@2.0.4, please try it. 😄 If there is still problem, let me know ;) then I would try to bump the major versions as well.

seandearnaley commented 7 years ago

I'm seeing this issue with the latest version of vue

"vue": "2.2.6", "vue-loader": "^11.3.3", "vue-template-compiler": "^2.2.6",

fritx commented 7 years ago

@seandearnaley oh, I cant reproduce your issue.

My steps:

  1. bump dep versions as yours
-    "vue": "^2.1.0",
-    "vue-loader": "^10.3.0",
+    "vue": "^2.2.6",
+    "vue-loader": "^11.3.4",   <-- a little difference, never mind
     "vue-style-loader": "^1.0.0",
-    "vue-template-compiler": "^2.2.4",
+    "vue-template-compiler": "^2.2.6",
  1. remove node_modules and reinstall

  2. npm run build

  3. change App.vue to link to dist

-// import At from '../dist'
-import At from './At.vue'
+import At from '../dist'
+// import At from './At.vue'

5 . npm run dev and it works

I guess a automatically CI build is necessary in the future though ;)

hugodias commented 7 years ago

Same issue here:

"vue": "^2.2.6",
"vue-at": "2.x",
"vue-loader": "^11.3.4",
"vue-template-compiler": "^2.2.6",

Anyone was able to solve the problem?

hugodias commented 7 years ago

Solved. Had to use version 2.0.4

yarn add vue-at@2.0.4
fritx commented 7 years ago

Hi, :+1: but seems nothing big changed between 2.0.4 and 2.0.5 (latest). Does vue-at 2.0.5 work with you or not?

katranci commented 7 years ago

I'm having the same issue in v2.0.5. Had to use v2.0.4.