Browse Source

小程序:购物车

panyong 2 years ago
parent
commit
02755932c5

+ 24 - 1
htmldev/wxMini/pages/contactBusiness/contactBusiness.js

@@ -3,7 +3,20 @@ Page({
   /**
    * 页面的初始数据
    */
-  data: {},
+  data: {
+    booShow: false,
+    actions: [
+      {
+        name: '呼叫'
+      },
+      {
+        name: '复制号码'
+      },
+      {
+        name: '添加到手机通讯录'
+      }
+    ]
+  },
 
   /**
    * 生命周期函数--监听页面加载
@@ -59,5 +72,15 @@ Page({
    */
   onShareAppMessage() {
 
+  },
+  showActionSheet() {
+    this.setData({ booShow: true })
+  },
+  hideActionSheet() {
+    this.setData({ booShow: false })
+  },
+
+  onSelect(event) {
+    console.log(event.detail)
   }
 })

+ 4 - 2
htmldev/wxMini/pages/contactBusiness/contactBusiness.json

@@ -1,3 +1,5 @@
 {
-  "usingComponents": {}
-}
+  "usingComponents": {
+    "van-action-sheet": "@vant/weapp/action-sheet/index"
+  }
+}

+ 14 - 2
htmldev/wxMini/pages/contactBusiness/contactBusiness.wxml

@@ -43,7 +43,8 @@
     <view class="value">
       <image class="icon-map" src=""></image>
       <view class="address-wrap">
-        <view class="address">地址:浙江省杭州市余杭区道浙江省杭州市余杭区道浙江省杭州市余杭区道浙江省杭州市余杭区道</view>
+        <view class="address">地址:浙江省杭州市余杭区道浙江省杭州市余杭区道浙江省杭州市余杭区道浙江省杭州市余杭区道
+        </view>
         <text class="phone" user-select>12345678910</text>
       </view>
       <image class="icon-arrow" src=""></image>
@@ -55,6 +56,17 @@
   <view class="tip">长按扫码,添加微信</view>
   <button
     class="btn-business"
-    type="primary">点击联系
+    type="primary"
+    bind:tap="showActionSheet">点击联系
   </button>
 </view>
+
+<van-action-sheet
+  show="{{ booShow }}"
+  actions="{{ actions }}"
+  cancel-text="取消"
+  description="13429176706可能是一个电话号码,你可以"
+  close-on-click-overlay="{{false}}"
+  bind:cancel="hideActionSheet"
+  bind:select="onSelect"
+/>