问答

小程序关于vant-weapp弹框弹出问题

作者:admin 2021-09-19 我要评论

引入了vant-weapp但出现弹出框不弹出 编辑 删除选项卡 版本"vant-weapp": "^0.5.5" 如图所示: ** feeditem.wxml代码如下: ** !--components/feeditem/feeditem...

在说正事之前,我要推荐一个福利:你还在原价购买阿里云、腾讯云、华为云服务器吗?那太亏啦!来这里,新购、升级、续费都打折,能够为您省60%的钱呢!2核4G企业级云服务器低至69元/年,点击进去看看吧>>>)

引入了vant-weapp但出现弹出框不弹出 编辑 删除选项卡
版本"vant-weapp": "^0.5.5"
如图所示:
8EBCC98FA1A3D0856B2B1FF68BF71486.png

**
feeditem.wxml代码如下:**

<!--components/feeditem/feeditem.wxml-->

<view class="scroll-view-item">

<view class="feedrow">

<view class="avatar"><image src="{{feeddata.user.avatar}}" mode="aspectFit" class="avatar-image"></image></view>

<view class="text">

<view class="userinfo">

<view class="user-left">

<view class="username">

{{feeddata.user.nickname}}<text class="uidspan">@u{{feeddata.user.id}}</text>

</view><view class="pubtime">{{time}}</view>

</view>

<view class="user-right">

<image src="/images/arrow.down@2x.png" mode="aspectFit" class="menu-icon" bindtap="toggle_menu" wx:if="{{feeddata.user.id == current_uid}}"></image>

</view>

</view>

<view class="content">{{feeddata.content}}</view>

<view class="actionbar"><image src="/images/retweet@2x.png" mode="aspectFit" class="action-icon"></image>转发</view>

</view>

</view>

<van-action-sheet

show="{{show_menu}}"

action="{{actions}}"

cancel-text="取消"

bind:close="onClose"

bind:cancel="onClose"

bind:select="onSelect"

/>

</view>

feeditem.js代码如下:

// components/feeditem/feeditem.js

import { format, render, cancel, register} from 'timeago.js';

import regeneratorRuntime from '../../utils/wxPromise.min.js';

Component({

/**

? * 组件的属性列表

? */

properties: {

feeddata:Object

},

/**

? * 组件的初始数据

? */

data: {

feeddata:null,

show_menu: false,

actions: []

},

lifetimes: {

attached(){

// ?console.log("in item");

this.setData({

"time":format(this.data.feeddata.creatrd_at,'zh_CN'),

"current_uid": getApp().globalData.guid,

"actions": [

{ "name": "编辑", "action": "modify", "fid": parseInt(this.data.feeddata.id, 10) },

{ "name": "删除", "action": "remove", "fid": parseInt(this.data.feeddata.id, 10) }

],

});

},

},

/**

? * 组件的方法列表

? */

methods: {

timeago(string){

console.log("FFF");

},

onClose(){

console.log("inclose");

this.setData({"show_menu":false});

},

onSelect(e){

const fid = e.detail.fid;

const action = e.detail.action;

if( action == 'remove'){

console.log("remove"+fid);

wx.pro.requert({

url: '',

data: {'token': app.globalData.token,'id': fid} }).then(ret=>{

console.log(ret);

});

}

},

toggle_menu(e) {

this.setData({ "show_menu": !this.data.show_menu });

// 设置action

const fid = parseInt(e.detail.fid, 10);

const theaction = [

{ "name": "编辑", "action": "modify", "fid": fid },

{ "name": "删除", "action": "remove", "fid": fid }

];

this.setData({ "actions": theaction, "show_menu": true });

},

}

})

版权声明:本文转载自网络,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。本站转载出于传播更多优秀技术知识之目的,如有侵权请联系QQ/微信:153890879删除

相关文章
  • 小程序关于vant-weapp弹框弹出问题

    小程序关于vant-weapp弹框弹出问题

  • 两个子域如何组建一个局域网?

    两个子域如何组建一个局域网?

  •  这句ts中,extends后面语句读不懂

    这句ts中,extends后面语句读不懂

  • 如何在python中用正则表达式匹配md文件

    如何在python中用正则表达式匹配md文件

腾讯云代理商
海外云服务器