首页 > 技术文章 > 使用zepto中animate报错“Uncaught TypeError: this.bind is not a function”的解决办法

zhahuhu 2019-08-05 10:43 原文

在使用zepto时,我先引入zepto.min.js,然后引入fx.js,但是在使用animate函数时,控制台却报如下错误:

Uncaught TypeError: this.bind is not a function

解决办法:

1、去github中打开src/fx.js,打开链接,把内容添加到zepto.min.js中,问题就解决了。然后需要什么模块就向zepto.min.js中添加该模块的内容,最后只用引入zepto.min.js。

2、zepto的定制:

(1)安装nodejs环境

(2)下载zepto.js并解压

(3)cmd命令行进入解压缩后的目录,执行npm install命令,安装node工具

(4)打开解压后的zepto文件下的make文件,找到target.build 部分,添加需要的模块并保存

(5)cmd执行npm run-script dist,此时zepto目录下会生成一个dist文件,引入dist文件下的zepto.min.js

 

推荐阅读