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

微信小程序之跳转页面(带参+不带参) #7

Open
gcindy opened this issue Apr 6, 2020 · 0 comments
Open

微信小程序之跳转页面(带参+不带参) #7

gcindy opened this issue Apr 6, 2020 · 0 comments

Comments

@gcindy
Copy link
Owner

gcindy commented Apr 6, 2020

带参

---传参---
// index.wxml
	<view class="file" wx:for="{{fileContent}}" wx:for-item="item" wx:key="fileContent" bindtap="jumpPage" data-id="{{item.id}}">
			<view class="fileImg">
				<image src="{{item.imgUrl}}" />
			</view>
			<text class="fileName">33</text>
		</view>

// index.js
jumpPage(e) {
    const id = e.currentTarget.dataset.id
    wx.navigateTo({
      url: './image/image?id=' + id,
    })
  }


--- 接收参数---
 onLoad: function (options) {
    var that = this
    console.log('options', options.id)
  },

不带参

// index.wxml
	<view class="file" wx:for="{{fileContent}}" wx:for-item="item" wx:key="fileContent" bindtap="jumpPage" >
			<view class="fileImg">
				<image src="{{item.imgUrl}}" />
			</view>
			<text class="fileName">33</text>
		</view>

// index.js
jumpPage(e) {
    wx.navigateTo({
      url: './image/image'
    })
  }





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

1 participant