Home>Article>WeChat Applet> WeChat Mini Program 0.11.122100 version update details introduction

WeChat Mini Program 0.11.122100 version update details introduction

高洛峰
高洛峰 Original
2017-03-08 17:11:27 2512browse

0.11.122100 Update Overview


  • Added 4 new APIs, 2 new components

  • Expansion Added 10 component properties and added 6 component events

  • Fixed dozens of API and component bugs and optimized some interactive experiences

  • Development The developer tool adds debugging support for new APIs and components

  • The developer tool adds debugging support for WeChat payment

The detailed update log is as follows:


Basic library update

  • A New API wx.switchTab Details

  • A New API wx .scanCode

  • A New API wx.createMapContext

  • A New API wx.createCanvasContext

  • A Added new API wx.showToast calling parameter mask

  • A Added new page method Page.onShareAppMessage for customizing sharing content

  • A New framework method App.onError

  • A New page configuration disabelScroll

  • A New component

  • A Added component, used to display customer service session button

  • A Added Component attribute openType

  • A Added Component attribute color

  • A Added component attribute objectFit

  • A Addedcomponent attribute markers polyline circles include-points controls show-location

  • A Added component attribute circular to control connection sliding

  • A Addedcomponent attribute cursor- spacing

  • A Addedcomponent attribute cursor-spacing

  • A Added component attribute disabled

  • A Add component attribute hover-class

  • A Add Component attributes scroll-x, scroll-y support dynamic modification

  • A Addedcomponent event bindtap bindmarkertap bindcontrolstap bindregionchange

  • A Addcomponent event bindconfirm

  • A Add component event bindtimeupdate

  • A Newcomponent event bindconfirm

  • A Newcomponent event bindinput

  • A New Component event bindlongtap

  • A Added AudioContext.setSrc() context API

  • A Added CanvasContext context

  • A Added CanvasContext.arc() context API

  • A Added CanvasContext.fillRect() context API

  • A New CanvasContext.strokeRect() context API

  • A New CanvasContext.createLinearGradient() context API

  • A New Added CanvasContext.createCircularGradient() context API

  • A Added component to prevent the page from scrolling when scrolling

  • U Update API wx.getSystemInfo Add platform return parameters

  • U Update API wx.downloadFile When the HTTP status code is 200 or 304, tmpFilePath will be returned

  • U Update the character limit of API wx.showModal call parameter confirmText cancelText

  • U Update WXML dataset return to support Object and Array

  • U Updatecomponent attribute mode optional widthFix

  • U Update component attribute range Add ObjectArray type support

  • U Update default style

  • U Update CanvasContext.save() CanvasContext.restore() Context API Save brush style

  • U Update CanvasContext.arc() Context API parameter adjustment, add eAngle, counterclockwise, remove sweepAngle

  • U Optimize the sliding experience of

  • U Optimize the interactive experience of in

  • U Optimize component click experience

  • F Fix wx.request method on Android can only use uppercase letters Value problem

  • F Fix the problem that wx.uploadFile cannot set header on iOS

  • F Fix wx.getLocation type=gcj02 on iOS The problem that it does not take effect

  • F Fix the problem that wx.showToast is still displayed after exiting the applet

  • F Fix the wx.showModal return parameter in Inconsistency between Android and iOS

  • F Fixed the layout disorder problem when wx.showModal content is too long or the title is empty

  • F Fix the problem that the default value is not displayed when wx.showModal cancelText and confirmText are empty

  • F Fix the problem that the keyboard pops up during wx.showModal and the keyboard cannot be closed

  • F Fix the problem that wx.getImageInfo cannot obtain http link images on Android

  • F Fixed the problem of inconsistent screen height obtained by wx.getSystemInfo due to tabbar appearance

  • F Fixed wx.downloadFile image not being displayed after downloading on Android Problem

  • F Fix the problem that wx.request does not correctly encode the request data

  • F Fix wx.login App.onLaunch in iOS No callback problem

  • F Fix wx.createAnimationContext setting transformOrigin exception and animation cannot proceed to the next step

  • F Fix wx.navigateTo wx .redirectTo On iOS, the problem that Page.onLoad cannot be called

  • F Fixed the problem that the default behavior of catch blocking events is invalid

  • F Fixed SetInterval parameter-passing error on iOS causes the page to freeze.

  • F Fixed the problem of onReachBottom triggering multiple times

  • F Fixed Problem with error when having descendants of text nodes

  • ##F Fix < The problem that the video/> hidden attribute does not take effect

  • F Fix the problem that the label does not take effect

  • F Fix the problem of sliding to the top or bottom of the splash screen

  • F Fix the problem of event not taking effect on iOS

  • F Fix the problem that the sound of will continue to exist after it is removed on iOS

  • F Fix The problem that class and style will not be dynamically updated when embedded

  • F Fixed the problem of incorrect text color whendisabled

  • F Fix the issue wherefocus attribute is invalid

  • F FixWhen using display:flex in iOS9, the first input is not displayed Problem

  • F Fix the problem ofdisplaying exception when the initial value is undefined

  • F Fix ; Placeholder ghosting problem

  • F Fix color abnormality problem before and after focusing

  • F Fix the problem of abnormal positioning ofposition:fixed

  • F Fix the problem ofnot triggering the blur event after opening the picker

  • F Fix the problem of height change when setting auto-height in

  • ##F Fix the problem of destruction exception of
  • F Fixed the problem that the full screen button in needs to be clicked twice to take effect on Android
  • ##F Fixed the problem in The problem of conflicting use of the same id in multiple pages
  • ##F Fixed the problem that drawImage cannot be displayed normally

  • F FixedIn the bindload event, setData will have an infinite loop problem

  • F Fix the problem of scroll-into-view failure

  • F Fix the problem that

    submit cannot get the input content

  • D The redirect attribute will be removed soon

  • D The wx.createContext interface will be removed soon

  • D Theauto-focus attribute will be removed soon, use focus directly Attributes

  • D will be removedcovers attribute


  • Basic functions of developer tools



A Added debugging support for wx.switchTab
  • A Added wx.startRecord wx.stopRecord wx.playVoice wx. pauseVoice wx.stopVoice API debugging support

  • A Added WeChat payment debugging support

  • A Added QR code scanning debugging support

  • A Added a new message about app.json repeatedly defining the page file, resulting in a submission preview error

  • A Added a new message about network error when loading images in the simulator

  • A Added the function of setting the initialization page and parameters when compiling

  • A Added the function of setting the initialization page and parameters when submitting the preview

  • F Optimize the appdata panel to view data in separate pages, support dynamic updates and code mode display

  • F Fix wx.getBackgroundAudioPlayerState when there is no music playing No return problem

  • F Fix wx.getBackgroundAudioPlayerState getting status incorrect problem

  • F Fix wxml panel white screen in some cases Problem

  • F Fixed the problem that wxml panel attributes cannot be copied, and the copy contains a carriage return

  • F Fixed the problem that wxml panel single text node is not displayed Alignment problem

  • F Fix the simulator display error when the tabbar position in app.json is set to top

  • F Fix devtools and The problem of incorrect clicking on external links in the editor

  • F Fixed the problem of wx.requst being unable to send the request due to cache

The following are the update details:


wx.switchTab(OBJECT)

Jump to the tabBar page and close all other non-tabBar pages
OBJECT parameters Description:
[tr]Parameter type required description[/tr]
url String is The path of the tabBar page that needs to be jumped (the page that needs to be defined in the field of app.json), the path cannot be followed by parameters
success Function No Callback function for successful interface call
fail Function No Interface call Failed callback function
complete Function No The callback function that ends the interface call (will be executed if the call is successful or failed) )
Sample code:
{ "tabBar": { "list": [{ "pagePath": "index", "text": "Homepage" },{ " pagePath": "other", "text": "other" }] }}wx.switchTab({ url: '/index'})




wx.scanCode( OBJECT)

Launch the client QR code scanning interface, and return the corresponding result after successful scanning.
Object parameter description:
[tr]Parameter type required description[/tr]
success Function No The interface calls the callback function successfully. For details of the return content, see the return parameter description.
fail Function No Callback function that fails to call the interface
complete Function No The callback function at the end of the interface call (will be executed if the call is successful or failed)
success returns Parameter description:
[tr]Parameter description[/tr]
result Content of code
Example Code:
wx.scanCode({ success: (res) => { console.log(res) }})




onShareAppMessage

Define the onShareAppMessage function in Page to set the sharing information of the page.
  • Only when this event handler is defined, the "Share" button will be displayed in the upper right corner menu

  • It will be called when the user clicks the share button

  • This event needs to return an Object for custom sharing content

Customized sharing field
[tr]Field description Default value[/tr] ##desc Sharing description Current applet name path Sharing path Current page path, required Is the complete path starting with / Sample code:
title Share title Current applet name
Page({ onShareAppMessage: function () { return { title: 'Customized sharing title', desc: 'Customized Share description', path: '/page/user?id=123' } }})



##wx.showToast(OBJECT)

Display message prompt Box
OBJECT parameter description:
[tr]Parameter type required description[/tr]

title icon duration mask success fail complete Sample code: wx.showToast({ title: 'Success ', icon: 'success', duration: 2000})
String Yes Prompt content
String No icon, only supports "success", "loading"
Number No The delay time of the prompt, in milliseconds, default: 1500, maximum 10000
Boolean No Whether to display a transparent mask to prevent touch penetration, default: false
Function No Callback function for successful interface call
Function No Callback function for failed interface call
Function No The callback function at the end of the interface call (will be executed if the call is successful or failed)


onShareAppMessage

Define the onShareAppMessage function in Page to set the sharing information of the page.


    Only when this event handler is defined, the "Share" button will be displayed in the upper right corner menu
  • It will be called when the user clicks the share button
  • This event needs to return an Object for custom sharing content

  • Customized sharing field
  • [tr]Field description Default value[/tr]


















title ##desc Sharing description Current applet name path Sharing path Current page path, required Is the full path starting with / Sample code:Page({ onShareAppMessage: function () { return { title: 'Customized share title', desc: 'Customized share description', path: '/page/user?id=123' } }} )wx.createCanvasContext(canvasId)DefinitionCreate canvas drawing context (specify canvasId)Tip: Need to specify canvasId, this drawing context only acts on the correspondingparameter[tr]Parameter type description[/tr]
Share title Current applet name
canvasId String Canvas representation, pass in the canvas-id defined in


##New component:


audioContext

audioContext is bound to an component through audioId, through which the corresponding component.
AudioContext object method list:
[tr]Method parameter description[/tr]
##setSrc play pause seek Sample code: // audio.jsPage({ onReady: function (e) { / / Use wx.createAudioContext to get the audio context context this.audioCtx = wx.createAudioContext('myAudio') this.audioCtx.setSrc('http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb.mp3?guid=ffffffff82def4af4b12b3cd9337d5e7 &uin= 346897220&vkey=6292F51E1E384E06DCBDC9AB7C49FD713D632D313AC4858BACB8DDD29067D3C601481D36E62053BF8DFEAF74C0A5CCFADD6471160CAF3E6A&fromtag=46') Ctx.play() }, data: { src: '' }, audioPlay: function () { this.audioCtx.play() }, audioPause: function () { this.audioCtx. pause() }, audio14: function () { this.audioCtx.seek(14) }, audioStart: function () { this.audioCtx.seek(0) }})
src Audio Address
None Play
None Pause
position Jump to the specified position, unit s



微信小程序0.11.122100 版本更新详情介绍picker-view

Scroll selector embedded in the page
[tr]Attribute name type default value description[/tr]








{{year}}year{{month}}month{{day}}day {{item}}years < view wx:for="{{months}}" style="line-height: 50px">{{item}}month ; {{item}}dayconst date = new Date()const years = []const months = []const days = []for (let i = 1990; i <= date.getFullYear(); i++) { years.push(i)}for (let i = 1 ; i <= 12; i++) { months.push(i)}for (let i = 1 ; i <= 31; i++) { days.push( i)}Page({ data: { years: years, year: date.getFullYear(), months: months, month: 2, days: days, day: 2, year: date.getFullYear(), value: [9999, 1, 1], }, bindChange: function(e) { const val = e.detail.value this.setData({ year: this.data.years[val[0]], month: this.data.months[val [1]], day: this.data.days[val[1]] }) }})
Canvas enhancement
  • A New CanvasContext context

  • A Newly added CanvasContext.arc() context API

  • A Newly added CanvasContext.fillRect() context API

  • A Added CanvasContext.strokeRect() context API

  • A Added CanvasContext.createLinearGradient() Context API

  • A Added CanvasContext. createCircularGradient() Context API



createCircularGradient

Definition

Creates a circular gradient color.
Tip: The starting point is at the center of the circle and the end point is at the ring.
Tip: You need to use addColorStop() to specify gradient points, at least two.



Parameters

[tr]Parameter type definition[/tr]
> value indicator-style bindchange EventHandle Note: Only thecomponent can be placed in it, other nodes will not be displayed.picker-view-columncan only be placed in, and the height of its child node will be automatically set to the same as the check box of picker-view Highly consistentSample code:
Number Array
The numbers in the array sequentially represent the number selected by the picker-view-colume in the picker-view (the subscript starts from 0), the number When the length of the picker-view-column options is greater than the length, the last item is selected.
String ##Set the style of the selected box in the middle of the selector
The change event is triggered when the value changes during scroll selection, event.detail = {value: value} ;value is an array, indicating which item is currently selected in the picker-view-column in the picker-view (the subscript starts from 0)
x Number x coordinate of the center of the circle
y Number y coordinate of the center of the circle
r Number The radius of the circle


##Example

const ctx = wx. createCanvasContext('myCanvas')// Create circular gradientconst grd = ctx.createCircularGradient(75, 50, 50)grd.addColorStop(0, 'red')grd.addColorStop(1, 'white')// Fill with gradientctx.setFillStyle (grd)ctx.fillRect(10, 10, 150, 80)ctx.draw()


微信小程序0.11.122100 版本更新详情介绍
##createLinearGradient

Definition

Create a linear gradient color.
Tip: You need to use addColorStop() to specify gradient points, at least two.



Parameters

[tr]Parameter type definition[/tr]

x0 y0 x1 y1
Number x coordinate of the starting point
Number y coordinate of the starting point
Number x coordinate of the end point
Number y coordinate of the end point

Example

const ctx = wx.createCanvasContext('myCanvas')// Create linear gradientconst grd = ctx.createLinearGradient(0 , 0, 200, 0)grd.addColorStop(0, 'red')grd.addColorStop(1, 'white')// Fill with gradientctx.setFillStyle(grd)ctx.fillRect(10, 10, 150, 80)ctx .draw()


strokeRect 微信小程序0.11.122100 版本更新详情介绍
Definition

Draw a rectangle (non-filled).
Tip: Use setFillStroke() to set the color of the rectangular line. If not set, the default is black.



Parameters

[tr]Parameter type range description[/tr]








微信小程序0.11.122100 版本更新详情介绍











x y width height Exampleconst ctx = wx.createCanvasContext('myCanvas')ctx.setStrokeStyle('red')ctx.strokeRect(10, 10, 150, 75)ctx.draw ()fillRectDefinitionFills a rectangle.Tip: Use setFillStyle() to set the fill color of the rectangle. If not set, the default is black.Parameters[tr]Parameter type description[/tr]
Number
The x-coordinate of the upper left corner of the rectangular path
Number
The y coordinate of the upper left corner of the rectangular path
Number
Rectangular path The width
Number ##The height of the rectangular path
x Number x coordinate of the upper left corner of the rectangular path
y Number y coordinate of the upper left corner of the rectangular path
width Number The width of the rectangular path
height Number The height of the rectangular path



Example

const ctx = wx.createCanvasContext('myCanvas')ctx.setFillStyle('red' )ctx.fillRect(10, 10, 150, 75)ctx.draw()

微信小程序0.11.122100 版本更新详情介绍

##arc

Definition

Draw an arc.
Tip: To create a circle, you can use the arc() method to specify that the actual arc is 0 and the ending arc is 2 * Math.PI.
Tip: Use the stroke() or fill() method to draw arcs in the canvas.



Parameters

[tr]Parameter type description[/tr]
x Number x coordinate of the circle y Number y coordinate of the circle r Number The radius of the circle sAngle Number Starting radian, unit radian ( At 3 o'clock) eAngle Number Ending arc counterclockwise Boolean Optional. Specifies whether the direction of radians is counterclockwise or clockwise. The default is false, which is clockwise.


Example

const ctx = wx.createCanvasContext('myCanvas')// Draw coordinatesctx.arc(100, 75, 50, 0, 2 * Math.PI)ctx.setFillStyle('#EEEEEE')ctx.fill()ctx.beginPath()ctx.moveTo(40, 75)ctx.lineTo(160, 75)ctx.moveTo(100 , 15)ctx.lineTo(100, 135)ctx.setStrokeStyle('#AAAAAA')ctx.stroke()ctx.setFontSize(12)ctx.setFillStyle('black')ctx.fillText('0', 165, 78 )ctx.fillText('0.5*PI', 83, 145)ctx.fillText('1*PI', 15, 78)ctx.fillText('1.5*PI', 83, 10)// Draw pointsctx.beginPath( )ctx.arc(100, 75, 2, 0, 2 * Math.PI)ctx.setFillStyle('lightgreen')ctx.fill()ctx.beginPath()ctx.arc(100, 25, 2, 0, 2 * Math.PI)ctx.setFillStyle('blue')ctx.fill()ctx.beginPath()ctx.arc(150, 75, 2, 0, 2 * Math.PI)ctx.setFillStyle('red')ctx .fill()// Draw arcctx.beginPath()ctx.arc(100, 75, 50, 0, 1.5 * Math.PI)ctx.setStrokeStyle('#333333')ctx.stroke()ctx.draw()
The three key coordinates for arc(100, 75, 50, 0, 1.5 * Math.PI) are as follows:
微信小程序0.11.122100 版本更新详情介绍
  • Green: Circle center (100, 75)

  • Red: Starting arc (0)

  • Blue: Ending arc (1.5 * Math.PI)






Drawing on Canvas

All drawings in must be done with JavaScript:
WXML: (We In the following examples, this WXML will be used as the template if there is no special statement and will not be repeated)
JS: (We In the following example, JS will be placed in onLoad)
const ctx = wx.createCanvasContext('myCanvas')ctx.setFillStyle('red')ctx.fillRect(10, 10, 150, 75)ctx. draw()


Step one: Create a Canvas drawing context

First, we need to create a Canvas drawing context CanvasContext.
CanvasContext is an object built into the applet and has some drawing methods:
const ctx = wx.createCanvasContext('myCanvas')


Step 2: Use Canvas drawing context Drawing description

Next, let's describe what we want to draw in Canvas.
Set the fill color of the drawing context to red:
ctx.setFillStyle('red') Use the fillRect(x, y, width, height) method to draw a rectangle and fill it with the red just set:
ctx .fillRect(10, 10, 150, 75)


Step 3: Draw

Tell the component that you want to draw the description just now:
ctx.draw()



The above is the detailed content of WeChat Mini Program 0.11.122100 version update details introduction. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn