在页面内引入
import Scratch from '@/common/scratch'
或者挂载到全局,
Vue.prototype.$Scratch = Scratch;
结果都是H5支持,app端报错,报错结果如下:
Property or method "touchStart" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property.
嗨哆嚒
- 发布:2020-08-24 16:34
- 更新:2020-08-24 16:53
- 阅读:858
app端如何引入单独的js文件
分类:uni-app
嗨哆嚒 (作者)
放在公共文件夹或者同一目录都一样。是一个构造函数,H5端没问题,app就报错
2020-08-24 16:41
爱吃鱼的靖哥哥
回复 嗨哆嚒: 好吧,估计是你的写法有问题
2020-08-24 16:42
嗨哆嚒 (作者)
回复 爱吃鱼的靖哥哥: import Scratch from '@/common/scratch'
new Scratch(this, {
canvasId: 'canvas-id',
width: this.scratchWidth,
height: this.scratchHeight,
size: this.scratchSize,
scale: this.scratchScale
})
2020-08-24 16:51
爱吃鱼的靖哥哥
回复 嗨哆嚒: 没有export吗
2020-08-24 16:53
嗨哆嚒 (作者)
回复 爱吃鱼的靖哥哥: 有的,H5正常
2020-08-24 17:17