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

希望embeddedItem加入对event的处理 #121

Open
von7750 opened this issue May 25, 2020 · 2 comments
Open

希望embeddedItem加入对event的处理 #121

von7750 opened this issue May 25, 2020 · 2 comments

Comments

@von7750
Copy link

von7750 commented May 25, 2020

对于自定义的embeddedItem似乎不支持事件的处理..

            <template v-slot:embeddedItem="s">
                <span><span class="tag" @click="$log(123)">123123</span></span>
            </template>
@fritx
Copy link
Owner

fritx commented May 27, 2020

@von7750 对目前只是提取innerHTL进行简单的插入,还没找到办法能在这支持vue语法
embededItem.innerHTML调用处 https://github.com/fritx/vue-at/blob/dev/src/At.vue#L468-L469

@von7750
Copy link
Author

von7750 commented May 28, 2020

这块弄好了,把innerHTML 给改了 改成直接移动节点, 这样所有的事件都会保留
AtTemplate.vue
<span v-show="false" ref="embeddedItem"> <slot v-for="i in enterList" name="embeddedItem" :current="i"></slot> </span>

这里用list是因为发现移动后 后面再用@ 就渲染到我移动后的那个节点上了。

但是还有个问题, 提交到服务器后, 下次再进来这里的事件肯定会失效了。
还是要再处理一次, 好像没有什么好办法

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