小程序小程序组件 | 右下角弹出菜单index.json { "component": true, "usingComponents": {} } index.js // components/popmenu/index.js Component({ /** * 组件的属性列表 */ properties: { }, /** * 组件的初始数据 */ data: { isPopping: tr作者王明昌发布时间2018-12-17最后更新2018-12-18 index.json 复制{ "component": true, "usingComponents": {} } index.js 复制// components/popmenu/index.js Component({ /** * 组件的属性列表 */ properties: { }, /** * 组件的初始数据 */ data: { isPopping: true,//是否已经弹出 animPlus: {},//旋转动画 animCollect: {},//item位移,透明度 animTranspond: {},//item位移,透明度 animInput: {}//item位移,透明度 }, /** * 组件的方法列表 */ methods: { plus: function () { if (this.data.isPopping) { //缩回动画 this.popp(); this.setData({ isPopping: false }) } else if (!this.data.isPopping) { //弹出动画 this.takeback(); this.setData({ isPopping: true }) } }, input: function () { console.log("input") }, transpond: function () { console.log("transpond") }, collect: function () { console.log("collect") }, //弹出动画 popp: function () { //plus顺时针旋转 var animationPlus = wx.createAnimation({ duration: 500, timingFunction: 'ease-out' }) var animationcollect = wx.createAnimation({ duration: 500, timingFunction: 'ease-out' }) var animationTranspond = wx.createAnimation({ duration: 500, timingFunction: 'ease-out' }) var animationInput = wx.createAnimation({ duration: 500, timingFunction: 'ease-out' }) animationPlus.rotateZ(180).step(); animationcollect.translate(-100, -100).rotateZ(180).opacity(1).step(); animationTranspond.translate(-140, 0).rotateZ(180).opacity(1).step(); animationInput.translate(-100, 100).rotateZ(180).opacity(1).step(); this.setData({ animPlus: animationPlus.export(), animCollect: animationcollect.export(), animTranspond: animationTranspond.export(), animInput: animationInput.export(), }) }, //收回动画 takeback: function () { //plus逆时针旋转 var animationPlus = wx.createAnimation({ duration: 500, timingFunction: 'ease-out' }) var animationcollect = wx.createAnimation({ duration: 500, timingFunction: 'ease-out' }) var animationTranspond = wx.createAnimation({ duration: 500, timingFunction: 'ease-out' }) var animationInput = wx.createAnimation({ duration: 500, timingFunction: 'ease-out' }) animationPlus.rotateZ(0).step(); animationcollect.translate(0, 0).rotateZ(0).opacity(0).step(); animationTranspond.translate(0, 0).rotateZ(0).opacity(0).step(); animationInput.translate(0, 0).rotateZ(0).opacity(0).step(); this.setData({ animPlus: animationPlus.export(), animCollect: animationcollect.export(), animTranspond: animationTranspond.export(), animInput: animationInput.export(), }) } } }) index.wxml 复制 index.wxss 复制.img-plus-style { height: 150rpx; width: 150rpx; position: absolute; bottom: 250rpx; right: 50rpx; z-index: 100; } .img-style { height: 150rpx; width: 150rpx; position: absolute; bottom: 250rpx; right: 30rpx; opacity: 0; }
2018-12-09小程序 | 在首页判断是否登录并跳转到登陆界面login //index.js import { config } from '../../config.js' Page({ /** * 页面的初始数据 */ data: { //判断小程序的AP
2019-07-22小程序判断是否包含某个字符(数组和字符串)console.log(['x', 'a'].indexOf('a')); // 1 console.log('dbac'.indexOf('aa')); // -1
2018-12-09小程序 | 在首页判断是否登录并登陆执行index.wxml //其他业务 我知道了 index.js import { config } from '../../config.js' // pages/index/index.js Pag
2018-10-07小程序组件 | mask遮罩层组件定义组件 wxml: wxss .container{ background-color: #000; position: fixed; top: 0; opacity: 0.6; width: 10
2018-12-09微信小程序 form表单input变化时自动搜索index.wxml 搜索 取消 index.js inputTyping: function (e) { var title = e.detail.value; console.log(e) //
2018-12-09小程序 | 小程序中使用关注公众号功能实现在小程序中显示公众号,点击后进行关注 使用组件 使用说明 使用组件前,需前往小程序后台,在“设置”->“接口设置”->“公众号关注组件”中设置要展示的公众号。 注:设置的公众号需与小程序主体一致。