GithubHelp home page GithubHelp logo

Comments (8)

wkl007 avatar wkl007 commented on May 4, 2024 9

我这里通过usingComponents导入iview-weapp src到mpvue中,在使用到action-sheet的时候handleClickItem1获取不到{detail}。原生小程序倒是能获取到。

handleClickItem1 ({detail}) {
const index = detail.index + 1
$Message({
content: '点击了选项' + index
})
},

好的,问题已解决,感谢 @jjjyy
问题:

若原生组件通过click事件,即this.triggerEvent('click', { index })来进行父子组件通信,mpvue无法从event.mp中读取到正确的detail,原因是因为mpvue将click事件编译为tap导致this.triggerEvent('click', { index })无法找到click句柄

解决方法:

修改组件库click事件名称,例如:
this.triggerEvent('click', { index }) => this.triggerEvent('iclick', { index })
对应的模板中:
@click => @iclick

受影响的组件(仅传值情况受影响)

action-sheet
modal

from iview-weapp.

icarusion avatar icarusion commented on May 4, 2024

可以,你如果想开发的话,我可以给你开一个 repo:iview-weapp-mpvue

from iview-weapp.

sunxiuming92 avatar sunxiuming92 commented on May 4, 2024

感谢大佬,可能只是给我们公司部门用,我自己的代码还拿不出手的(之前公司的后台我就是用的iview去搭的,真的很舒服,谢谢大佬一直在造轮子,会一直支持的)

from iview-weapp.

zhaohuanlei avatar zhaohuanlei commented on May 4, 2024

好想法,支持改成MPvue的。。我们的新项目也准备入坑MPvue了

from iview-weapp.

spx443812507 avatar spx443812507 commented on May 4, 2024

在mpvue中怎么使用$Message组件呢

from iview-weapp.

bigmeow avatar bigmeow commented on May 4, 2024

其实不需要专门搞一套mpvue版本的 ,在mpvue里直接引入原生组件就行了 ,不过要注意下iview的库是es6写的 ,需要用babel转一下再引入到mpvue里,或者改mpvue的脚手架

from iview-weapp.

rendq avatar rendq commented on May 4, 2024

我这里通过usingComponents导入iview-weapp src到mpvue中,在使用到action-sheet的时候handleClickItem1获取不到{detail}。原生小程序倒是能获取到。

handleClickItem1 ({detail}) {
const index = detail.index + 1
$Message({
content: '点击了选项' + index
})
},

好的,问题已解决,感谢 @jjjyy
问题:

若原生组件通过click事件,即this.triggerEvent('click', { index })来进行父子组件通信,mpvue无法从event.mp中读取到正确的detail,原因是因为mpvue将click事件编译为tap导致this.triggerEvent('click', { index })无法找到click句柄

解决方法:

修改组件库click事件名称,例如:
this.triggerEvent('click', { index }) => this.triggerEvent('iclick', { index })
对应的模板中:
@click => @iclick

受影响的组件(仅传值情况受影响)

action-sheet
modal


解决方法:

修改组件库click事件名称,例如:
this.triggerEvent('click', { index }) => this.triggerEvent('iclick', { index })
对应的模板中:
@click => @iclick

按照这样改了也同样拿不到detail值

from iview-weapp.

whiteMu avatar whiteMu commented on May 4, 2024

@rendq 事件获取index为
handleClickItem1 ({mp}) {
const index = mp.detail.index
$Message({
content: '点击了选项' + index
})
},

from iview-weapp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.