123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- import zIndex from '../behaviors/zIndex';
- Component({
- /**
- * 组件的属性列表
- */
- behaviors: [zIndex],
- externalClasses: ['l-bg-class'],
- properties: {
- // 显示与隐藏
- show: {
- type: Boolean,
- value: false
- },
- // 动画效果的显示和隐藏
- animation: {
- type: Boolean,
- value: true
- },
- // slot的位置
- contentAlign: {
- type: String,
- value: 'center'
- },
- // 锁定
- locked: {
- type: Boolean,
- value: false
- }
- },
- attached() {
- this._init();
- },
- pageLifetimes: {
- show() {
- this._init();
- },
- },
- /**
- * 组件的初始数据
- */
- data: {
- status: 'show'
- },
- /**
- * 组件的方法列表
- */
- methods: {
- _init() {
- wx.lin = wx.lin || {};
- wx.lin.showPopup = (options) => {
- const {
- zIndex = 99,
- animation = true,
- contentAlign = 'center',
- locked = false
- } = { ...options };
- this.setData({
- zIndex,
- animation,
- contentAlign,
- locked,
- show: true
- });
- };
- wx.lin.hidePopup = () => {
- this.setData({
- status: 'hide'
- });
- setTimeout(()=>{
- this.setData({
- show: false
- });
- },300);
- };
- },
- // 阻止滑动
- doNothingMove() {
- // do nothing……
- },
- doNothingTap() {
- // do nathing
- },
- // 点击事件
- onPupopTap() {
- let detail = true;
- let option = { bubbles: true, composed: true };
- if (this.data.locked !== true) {
- if(!this.data.show) {
- this.setData({
- show: true,
- status: 'show'
- });
- } else {
- this.setData({
- status: 'hide'
- });
- setTimeout(()=>{
- this.setData({
- show: false,
- status: 'show'
- });
- },300);
- }
- // this.setData({
- // show: !this.data.show
- // });
- }
- this.triggerEvent('lintap', detail, option);
- }
- }
- });
|