{"id":33423,"date":"2024-11-25T15:30:15","date_gmt":"2024-11-25T07:30:15","guid":{"rendered":"https:\/\/fwq.ai\/blog\/33423\/"},"modified":"2024-11-25T15:30:15","modified_gmt":"2024-11-25T07:30:15","slug":"%e4%bd%bf%e7%94%a8%e5%b0%8f%e7%a8%8b%e5%ba%8f%e5%86%99%e4%b8%80%e4%b8%aa%e5%bc%b9%e7%aa%97%e8%be%93%e5%85%a5%e7%bb%84%e4%bb%b6","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/33423\/","title":{"rendered":"\u4f7f\u7528\u5c0f\u7a0b\u5e8f\u5199\u4e00\u4e2a\u5f39\u7a97\u8f93\u5165\u7ec4\u4ef6"},"content":{"rendered":"<p>\u5199\u9879\u76ee\u7684\u65f6\u5019\u53d1\u73b0\u5c0f\u7a0b\u5e8f\u6ca1\u6709\u81ea\u5e26\u7684\u5f39\u7a97\u8f93\u5165\u7684\u7ec4\u4ef6\uff0c\u53ea\u80fd\u81ea\u5df1\u5199\u4e00\u4e2a\u3002<\/p>\n<h5>1.\u534a\u900f\u660e\u7684\u906e\u76d6\u5c42<\/h5>\n<p>\u906e\u76d6\u5c42\u7684\u6837\u5f0f\u548c\u663e\u9690\u4e8b\u4ef6<br \/>wxml\u4ee3\u7801\uff1a<\/p>\n<pre>&lt;view class=\"body\"&gt;\n  &lt;button bindtap='eject'&gt;\u5f39\u7a97&lt;\/button&gt;\n&lt;\/view&gt;\n&lt;view class=\"model\" catchtouchmove='preventTouchMove' wx:if='{{showModal}}'&gt;&lt;\/view&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>wxss\u4ee3\u7801\uff1a<\/p>\n<pre>.model{\n  position: absolute;\n  width: 100%;\n  height: 100%;\n  background: #000;\n  z-index: 999;\n  opacity: 0.5;\n  top: 0;\n  left:0;\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>js\u4ee3\u7801\uff1a<\/p>\n<pre> \/**\n   * \u9875\u9762\u7684\u521d\u59cb\u6570\u636e\n   *\/\n  data: {\n    showModal: false,\n  },\n\n  \/**\n   * \u63a7\u5236\u906e\u76d6\u5c42\u7684\u663e\u793a\n   *\/\n  eject:function(){\n    this.setData({\n      showModal:true\n    })\n  }<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<h5>2.\u5f39\u7a97\u7a97\u53e3\u5b9e\u73b0<\/h5>\n<p>\u5f39\u7a97\u7a97\u53e3\u7684\u6837\u5f0f\u548c\u663e\u9690\u4e8b\u4ef6<br \/>wxml\u4ee3\u7801\uff1a<\/p>\n<pre>&lt;view class=\"modalDlg\" catchtouchmove='preventTouchMove' wx:if='{{showModal}}'&gt;\n  &lt;view class='windowRow'&gt;\n    &lt;text class='userTitle'&gt;\u6807\u9898\n  &lt;\/text&gt;\n    &lt;view class='back' bindtap='back'&gt;\n      \u8fd4\u56de\n    &lt;\/view&gt;\n  &lt;\/view&gt;\n  &lt;view class='wishName'&gt;\n    &lt;input bindinput='wish_put' placeholder='\u8bf7\u8f93\u5165\u5185\u5bb9' class='wish_put'&gt;&lt;\/input&gt;\n  &lt;\/view&gt;\n  &lt;view class='wishbnt'&gt;\n    &lt;button class='wishbnt_bt' bindtap='ok'&gt;\u786e\u5b9a&lt;\/button&gt;\n  &lt;\/view&gt;\n&lt;\/view&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>wxss\u4ee3\u7801\uff1a<\/p>\n<pre>.modalDlg{\n  width: 70%;\n  position: fixed;\n  top:350rpx;\n  left: 0;\n  right: 0;\n  z-index: 9999;\n  margin: 0 auto;\n  background-color: #fff;\n  border-radius: 10rpx;\n  display: flex;\n  flex-direction: column;\n  align-items: center;\n}\n\n.windowRow{\n  display: flex;\n  flex-direction: row;\n  justify-content: space-between;\n  height: 110rpx;\n  width: 100%;\n}\n\n.back{\n  text-align: center;\n  color: #f7a6a2;\n  font-size: 30rpx;\n  margin: 30rpx;\n}\n\n.userTitle{\n  font-size: 30rpx;\n  color: #666;\n  margin: 30rpx;\n}\n\n.wishName{\n  width: 100%;\n  justify-content: center;\n  flex-direction: row;\n  display: flex;\n  margin-bottom: 30rpx;\n}\n\n.wish_put{\n  width: 80%;\n  border: 1px solid;\n  border-radius: 10rpx;\n  padding-left: 10rpx;\n}\n\n.wishbnt{\n  width: 100%;\n  font-size: 30rpx;\n  margin-bottom: 30rpx;\n}\n\n\n.wishbnt_bt{\n  width: 50%;\n  background-color: #f7a6a2;\n  color: #fbf1e8;\n  font-size: 30rpx;\n  border: 0;\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>js\u4ee3\u7801\uff1a<\/p>\n<pre>\/**\n   * \u9875\u9762\u7684\u521d\u59cb\u6570\u636e\n   *\/\n  data: {\n    showModal: false,\n    textV:''\n  },\n\n  \/**\n   * \u63a7\u5236\u663e\u793a\n   *\/\n  eject:function(){\n    this.setData({\n      showModal:true\n    })\n  },\n\n  \/**\n   * \u70b9\u51fb\u8fd4\u56de\u6309\u94ae\u9690\u85cf\n   *\/\n  back:function(){\n    this.setData({\n      showModal:false\n    })\n  },\n\n  \/**\n   * \u83b7\u53d6input\u8f93\u5165\u503c\n   *\/\n  wish_put:function(e){\n    this.setData({\n      textV:e.detail.value\n    })\n  },\n\n  \/**\n   * \u70b9\u51fb\u786e\u5b9a\u6309\u94ae\u83b7\u53d6input\u503c\u5e76\u4e14\u5173\u95ed\u5f39\u7a97\n   *\/\n  ok:function(){\n    console.log(this.data.textV)\n    this.setData({\n      showModal:false\n    })\n  }<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<h5>3.\u5b8c\u6574\u4ee3\u7801<\/h5>\n<p>\u6700\u540e\u732e\u4e0a\u5b8c\u6574\u4ee3\u7801\uff0c\u6709\u70b9\u5570\u55e6\u4e86\uff0c\u60f3\u5c3d\u91cf\u8be6\u7ec6\u70b9<br \/>wxml\u4ee3\u7801\uff1a<\/p>\n<pre>&lt;view class=\"body\"&gt;\n  &lt;button bindtap='eject'&gt;\u5f39\u7a97&lt;\/button&gt;\n&lt;\/view&gt;\n&lt;view class=\"model\" catchtouchmove='preventTouchMove' wx:if='{{showModal}}'&gt;&lt;\/view&gt;\n&lt;view class=\"modalDlg\" catchtouchmove='preventTouchMove' wx:if='{{showModal}}'&gt;\n  &lt;view class='windowRow'&gt;\n    &lt;text class='userTitle'&gt;\u6807\u9898\n  &lt;\/text&gt;\n    &lt;view class='back' bindtap='back'&gt;\n      \u8fd4\u56de\n    &lt;\/view&gt;\n  &lt;\/view&gt;\n  &lt;view class='wishName'&gt;\n    &lt;input bindinput='wish_put' placeholder='\u8bf7\u8f93\u5165\u5185\u5bb9' class='wish_put'&gt;&lt;\/input&gt;\n  &lt;\/view&gt;\n  &lt;view class='wishbnt'&gt;\n    &lt;button class='wishbnt_bt' bindtap='ok'&gt;\u786e\u5b9a&lt;\/button&gt;\n  &lt;\/view&gt;\n&lt;\/view&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>wxss\u4ee3\u7801\uff1a<\/p>\n<pre>.body{\n  width: 100%;\n  height: 100%;\n  background-color: #fff;\n  position: fixed;\n  display: flex;\n}\n\n.body button{\n  height: 100rpx;\n}\n\n.model{\n  position: absolute;\n  width: 100%;\n  height: 100%;\n  background: #000;\n  z-index: 999;\n  opacity: 0.5;\n  top: 0;\n  left:0;\n}\n\n.modalDlg{\n  width: 70%;\n  position: fixed;\n  top:350rpx;\n  left: 0;\n  right: 0;\n  z-index: 9999;\n  margin: 0 auto;\n  background-color: #fff;\n  border-radius: 10rpx;\n  display: flex;\n  flex-direction: column;\n  align-items: center;\n}\n\n.windowRow{\n  display: flex;\n  flex-direction: row;\n  justify-content: space-between;\n  height: 110rpx;\n  width: 100%;\n}\n\n.back{\n  text-align: center;\n  color: #f7a6a2;\n  font-size: 30rpx;\n  margin: 30rpx;\n}\n\n.userTitle{\n  font-size: 30rpx;\n  color: #666;\n  margin: 30rpx;\n}\n\n.wishName{\n  width: 100%;\n  justify-content: center;\n  flex-direction: row;\n  display: flex;\n  margin-bottom: 30rpx;\n}\n\n.wish_put{\n  width: 80%;\n  border: 1px solid;\n  border-radius: 10rpx;\n  padding-left: 10rpx;\n}\n\n.wishbnt{\n  width: 100%;\n  font-size: 30rpx;\n  margin-bottom: 30rpx;\n}\n\n\n.wishbnt_bt{\n  width: 50%;\n  background-color: #f7a6a2;\n  color: #fbf1e8;\n  font-size: 30rpx;\n  border: 0;\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>js\u4ee3\u7801\uff1a<\/p>\n<pre>Page({\n\n  \/**\n   * \u9875\u9762\u7684\u521d\u59cb\u6570\u636e\n   *\/\n  data: {\n    showModal: false,\n    textV:''\n  },\n\n  \/**\n   * \u63a7\u5236\u663e\u793a\n   *\/\n  eject:function(){\n    this.setData({\n      showModal:true\n    })\n  },\n\n  \/**\n   * \u70b9\u51fb\u8fd4\u56de\u6309\u94ae\u9690\u85cf\n   *\/\n  back:function(){\n    this.setData({\n      showModal:false\n    })\n  },\n\n  \/**\n   * \u83b7\u53d6input\u8f93\u5165\u503c\n   *\/\n  wish_put:function(e){\n    this.setData({\n      textV:e.detail.value\n    })\n  },\n\n  \/**\n   * \u70b9\u51fb\u786e\u5b9a\u6309\u94ae\u83b7\u53d6input\u503c\u5e76\u4e14\u5173\u95ed\u5f39\u7a97\n   *\/\n  ok:function(){\n    console.log(this.data.textV)\n    this.setData({\n      showModal:false\n    })\n  }\n})<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u63a8\u8350\u6559\u7a0b\uff1a\u300a\u300b&nbsp;<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u4f7f\u7528\u5c0f\u7a0b\u5e8f\u5199\u4e00\u4e2a\u5f39\u7a97\u8f93\u5165\u7ec4\u4ef6\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5199\u9879\u76ee\u7684\u65f6\u5019\u53d1\u73b0\u5c0f\u7a0b\u5e8f\u6ca1\u6709\u81ea\u5e26\u7684\u5f39\u7a97\u8f93\u5165\u7684\u7ec4\u4ef6\uff0c\u53ea\u80fd\u81ea\u5df1\u5199\u4e00\u4e2a\u3002 1.\u534a\u900f\u660e\u7684\u906e\u76d6\u5c42 \u906e\u76d6\u5c42\u7684\u6837\u5f0f\u548c\u663e\u9690\u4e8b\u4ef6wxml\u4ee3\u7801\uff1a &lt;view class=&#8221;body&#8221;&gt; &lt;button bindtap=&#8217;eject&#8217;&gt;\u5f39\u7a97&lt;\/button&gt; &lt;\/view&gt; &lt;view class=&#8221;model&#8221; catchtouchmove=&#8217;preventTouchMove&#8217; wx:if='{{showModal}}&#8217;&gt;&lt;\/view&gt; \u767b\u5f55\u540e\u590d\u5236 wxss\u4ee3\u7801\uff1a .model{ position: absolute; width: 100%; height: 100%; background: #000; z-index: 999; opacity: 0.5; top: 0; left:0; } \u767b\u5f55\u540e\u590d\u5236 js\u4ee3\u7801\uff1a \/** * \u9875\u9762\u7684\u521d\u59cb\u6570\u636e *\/ data: { showModal: false, }, \/** * \u63a7\u5236\u906e\u76d6\u5c42\u7684\u663e\u793a *\/ eject:function(){ this.setData({ showModal:true }) } \u767b\u5f55\u540e\u590d\u5236 2.\u5f39\u7a97\u7a97\u53e3\u5b9e\u73b0 \u5f39\u7a97\u7a97\u53e3\u7684\u6837\u5f0f\u548c\u663e\u9690\u4e8b\u4ef6wxml\u4ee3\u7801\uff1a &lt;view [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19],"tags":[],"class_list":["post-33423","post","type-post","status-publish","format-standard","hentry","category-19"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/33423","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=33423"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/33423\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=33423"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=33423"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=33423"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}