bsdfzzzy / vue2-hammer

Hammer.js wrapper for Vue 2.x to support some touching operation in the mobile.
MIT License
253 stars 48 forks source link

IE 11 error: "Expected: ':'" #15

Closed Demy closed 5 years ago

Demy commented 6 years ago

I added the plugin to the site and it works fine in Chrome, but in IE it throws the error. Expected: ':' There's even no need to call something, the error appears immediately after "include" and "use" of the plugin.

bsdfzzzy commented 6 years ago

Can you show me the whole log? @Demy

Demy commented 6 years ago

It's not very informative:

SCRIPT1003: Expected ':'
File: app.js, Line: 3126, Column: 1

And it points to the hammer plugin included to the app.js and minified. So, it's the full code of the plugin.

I think it might have something to do with IE inner code keys, like, it thinks that something in the plugin looks like an IE command. But it's just a guess.

Demy commented 6 years ago

Update: it points to

t.directive("hammer",{
     bind(t,n) {

Exact place: bind<the cursor points here>(t,n) {

controversial commented 6 years ago

getting the same error. It's because this is es6 syntax for defining the function as an object property implicitly without manually setting a key.

k0ph1e commented 5 years ago

I'm also experiencing this issue. Is there known solution about this?

UPDATE: I found a solution. Just add 'vue2-hammer' into transpileDependecies in your vue.config.js file. More information about this can be found explained here.

bsdfzzzy commented 5 years ago

Everyone, I have already publish a 2.0.0 version, if this issues still exist, please let me know.

k0ph1e commented 5 years ago

It works fine now, thanks!