<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
>
<channel>
<title><![CDATA[谢一一]]></title> 
<atom:link href="https://www.xiedandan.com/rss.php" rel="self" type="application/rss+xml" />
<description><![CDATA[月光下总有一扇青窗，坚持说你是唯一被等待的人。]]></description>
<link>https://www.xiedandan.com/</link>
<language>zh-cn</language>
<generator>www.emlog.net</generator>
<item>
    <title>OpenAI开发者最新稳定充值安全绑卡使用ChatGPT：WildCard推荐</title>
    <link>https://www.xiedandan.com/post-27.html</link>
    <description><![CDATA[<p>2023-11-28更新：千万不要用微软账号登录注册openAI，估计是微软提供了国家信息，大概率会封。<br /><br />
<br /><br />
2023-10-19亲测绑定充值成功！<br /><br />
作为程序猿，又要开发自己的chatGPT微信小程序，当然不能买账号，自己注册才是最安全保险的。<br /><br />
注册账号会送5美元余额，会限制每天200次，经常就用限额，要充值进来才会提高限额。<br /><br />
<br /><br />
然后了解了下充值平台：<br /><br />
OneKay Card在9月30号之后就不能大陆注册了，哭死，错过了。我还特意去推特看了官方公告，然后也去官网注册，中国确实选不了。<br style="box-sizing:content-box;" /><br />
Depay据说封号机率太大，没得搞手。<br /><br />
只有wildCard好像挺靠谱，2年年费14.08刀，充值3.5%手续费，平摊下来也还行吧。<br /><br />
<br style="text-wrap:wrap;" /><br />
<span style="text-wrap:wrap;">注册虚拟信用卡：</span><a href="https://bewildcard.com/i/VUE" target="_blank" style="text-wrap:wrap;"><a href="https://bewildcard.com/i/VUE">https://bewildcard.com/i/VUE</a><br /><br />
</a><span style="text-wrap:wrap;">需要邀请码才能注册成功！可以使用博主邀请链接注册，会返点辛苦码字钱。我的邀请码是：VUE</span><br style="text-wrap:wrap;" /><br />
<span style="text-wrap:wrap;">用邀请码88折！</span><br style="text-wrap:wrap;" /><br />
<span style="text-wrap:wrap;">会使用支付宝实名认证，可以放心使用，简单方便。</span><br style="text-wrap:wrap;" /><br />
<span style="text-wrap:wrap;"></span><br style="text-wrap:wrap;" /><br />
<span style="text-wrap:wrap;">费用是这样的：</span><br style="text-wrap:wrap;" /><br />
<span style="text-wrap:wrap;"></span><a target="_blank" href="https://www.xiedandan.com/content/uploadfile/202310/96ac1697717007.jpg" id="ematt:49"><img src="https://www.xiedandan.com/content/uploadfile/202310/96ac1697717007.jpg" title="点击查看原图" alt="wildCard_money.jpg" border="0" width="1275" height="1178" /></a><a target="_blank" href="https://www.xiedandan.com/content/uploadfile/202310/96ac1697717007.jpg"><br /><br />
</a>支付开卡费用就是卡界面，然后再充值，我是充值的30美元，因为openAI在绑上时会扣除5美元，再退回给你验证卡。如果卡里没钱就去绑定openAi会封号！！！一定要充钱，反正也要，至少充15刀吧<br style="text-wrap:wrap;" /><br />
<span style="text-wrap:wrap;"></span><a target="_blank" href="https://www.xiedandan.com/content/uploadfile/202310/069d1697717617.jpg" id="ematt:51"><img src="https://www.xiedandan.com/content/uploadfile/202310/069d1697717617.jpg" title="点击查看原图" alt="wildcard_money2.jpg" border="0" width="1147" height="1421" /></a><br /><br />
然后在openAI开发者中心进入添加银行卡页面。卡信息最右侧也要填邮政编号，我眼瞎没看到，一直点提交总是报错，最后问WildCard客服才告诉我这里也要填邮编。感谢WildCard客服，真的1分钟内就有响应。<br /><br />
由于这里提交多次，后面提交的时候提示我&nbsp;<span style="-webkit-text-stroke-color:initial;">You're making too many requests, please slow down. 隔好久再提交依然是这样。<br /><br />
然后我就又注册了个新号，注册新号我没使用WildCard提供的免费手机号和美国IP，我科学上网挂的美国注册的。</span> </p>
<div class="alert-body" style="box-sizing:border-box;display:flex;flex:1 1 auto;flex-direction:column;justify-content:center;text-wrap:wrap;-webkit-text-stroke-color:initial !important;">
    <div>
        <br />
    </div>
</div>
<p><br /><br />
<a target="_blank" href="https://www.xiedandan.com/content/uploadfile/202310/4eb81697718030.jpg" id="ematt:55"><img src="https://www.xiedandan.com/content/uploadfile/202310/4eb81697718030.jpg" title="点击查看原图" alt="openai_pay2.jpg" border="0" width="1026" height="790" /></a><br /><br />
<a target="_blank" href="https://www.xiedandan.com/content/uploadfile/202310/64f51697718119.jpg" id="ematt:57"><img src="https://www.xiedandan.com/content/uploadfile/202310/64f51697718119.jpg" title="点击查看原图" alt="chatGPT_pay_type.jpg" border="0" width="710" height="763" /><br /><br />
</a><a target="_blank" href="https://www.xiedandan.com/content/uploadfile/202310/c8681697718137.jpg" id="ematt:59"><img src="https://www.xiedandan.com/content/uploadfile/202310/c8681697718137.jpg" title="点击查看原图" alt="chatGPT_pay_type2.jpg" border="0" width="667" height="679" /></a><br /><br />
充值完，最后看下使用量限额<br /><br />
<a target="_blank" href="https://www.xiedandan.com/content/uploadfile/202310/a4471697718479.jpg" id="ematt:61"><img src="https://www.xiedandan.com/content/uploadfile/202310/a4471697718479.jpg" title="点击查看原图" alt="chatgpt_sudu.jpg" border="0" width="1234" height="1050" /></a><br /><br />
到这里就充值结束了，可以安心的使用API了，不用再担心免费的200次/天的限额了。<br /><br />
<br /><br />
注册流程大家都会了，这里简单说下流程：<br /><br />
划重点！！如果没注册的就跳过这一步，开卡平台WildCard会送省外手机号、邮箱，送美国家庭环境IP，这时候再注册又能省一点钱。<br /><br />
<br /><br />
开科学上网，全局，美国或者日本之类的，不要香港。<br /><br />
官网注册，我是使用谷歌和微软账号注册的，使用邮箱注册也行。<br /><br />
手机号码收验证码平台：<a href="https://sms-activate.org/" target="_blank"><a href="https://sms-activate.org/cn">https://sms-activate.org/cn</a></a><br /><br />
我选的最便宜的印度和阿根廷，印度的有机率收不到验证码或者已使用，看运气。<br /><br />
没收到验证码就点换号码，或者点X按钮删掉号码，这样钱会退回。有时间倒计时的，在倒计时内免费退。<br /><br />
短信平台现在最低充值2美元，加税合计15.42元（2.1美元）<br /><br />
<a target="_blank" href="https://www.xiedandan.com/content/uploadfile/202310/90431697716095.jpg" id="ematt:47"><img src="https://www.xiedandan.com/content/uploadfile/202310/90431697716095.jpg" title="点击查看原图" alt="duanxinpingtai.jpg" border="0" width="349" height="790" /></a><a target="_blank" href="https://www.xiedandan.com/content/uploadfile/202310/90431697716095.jpg"><br /><br />
</a><span style="text-wrap:wrap;">流程注册完进入开发者平台</span>&nbsp;<a href="https://platform.openai.com/account/usage" target="_blank"><a href="https://platform.openai.com/account/usage">https://platform.openai.com/account/usage</a></a><br /><br />
<br /><br />
最后：推荐下我开发的小程序：ai自由畅想<br /><br />
<a target="_blank" href="https://www.xiedandan.com/content/uploadfile/202403/90f31709627642.jpg" id="ematt:63"><img src="https://www.xiedandan.com/content/uploadfile/202403/90f31709627642.jpg" title="点击查看原图" alt="mmexport1699494214444.jpg" border="0" width="720" height="1210" /></a><br /><br />
<br /></p>]]></description>
    <pubDate>Thu, 19 Oct 2023 19:36:46 +0800</pubDate>
    <dc:creator>谢单单</dc:creator>
    <guid>https://www.xiedandan.com/post-27.html</guid>
</item>
<item>
    <title>js使用moment获取今天12点昨天9点明天17点</title>
    <link>https://www.xiedandan.com/post-26.html</link>
    <description><![CDATA[<p>获取今天中午12点<br /></p>
<pre class="prettyprint lang-js linenums">moment('12:00:00', 'HH:mm:ss').format('YYYY-MM-DD HH:mm:ss')</pre>
<p><br /><br />
<br /><br />
获取上一天昨天上午9点<br /></p>
<pre class="prettyprint lang-js linenums">//使用subtract减去1天
moment('09:00:00', 'HH:mm:ss').subtract(1, 'day').format('YYYY-MM-DD HH:mm:ss')</pre>
<p><br /><br />
<br /><br />
获取下一天明天下午17点<br /><br />
<br /></p>
<pre class="prettyprint lang-js linenums">//使用add增加1天
moment('17:00:00', 'HH:mm:ss').add(1, 'day').format('YYYY-MM-DD HH:mm:ss')</pre>
<p><br /></p>]]></description>
    <pubDate>Sun, 18 Jun 2023 16:39:57 +0800</pubDate>
    <dc:creator>谢单单</dc:creator>
    <guid>https://www.xiedandan.com/post-26.html</guid>
</item>
<item>
    <title>宝塔mysql恢复数据binlog提取sql，拯救int类型存手机号的问题</title>
    <link>https://www.xiedandan.com/post-25.html</link>
    <description><![CDATA[<p>这天开发H5的时候脑子一抽，用int类型来存手机号，这样字段会小很多才对！想着想着就为自己的机智点赞！<br /><br />
<a target="_blank" href="https://www.xiedandan.com/content/uploadfile/202212/37561671091529.png" id="ematt:38"><img src="https://www.xiedandan.com/content/uploadfile/202212/37561671091529.png" title="点击查看原图" alt="sql1.png" border="0" width="618" height="297" /><br /><br />
</a>然后眼瞎一直没发现手机号码不对，直到活动结束导出数据才发现手机号不对，一查int最大值是2147483647，只有10位数，手机号是没法存的。<br /><br />
<a target="_blank" href="https://www.xiedandan.com/content/uploadfile/202212/5e1c1671091874.jpg" id="ematt:40"><img src="https://www.xiedandan.com/content/uploadfile/202212/5e1c1671091874.jpg" title="点击查看原图" alt="sql2.jpg" border="0" width="283" height="251" /><br /><br />
</a>然后就是想办法恢复数据了<br /><br />
接口是post存的数据，nginx日志没用，只有从Mysql Binlog恢复了，还好宝塔是默认开启binlog的。<br /><br />
<br /><br />
1、找到mysql的二进制日志binlog目录<br /></p>
<pre class="prettyprint lang-bsh linenums">cd /www/server/data</pre>
<p><br /><br />
2、根据你需要的数据日期确定binlog是哪几个文件，然后执行下面的命令转成sql文件<br /><br />
<a target="_blank" href="https://www.xiedandan.com/content/uploadfile/202212/12781671092600.jpg" id="ematt:41"><img src="https://www.xiedandan.com/content/uploadfile/202212/12781671092600.jpg" title="点击查看原图" alt="sql3.jpg" border="0" width="937" height="444" /></a><br /></p>
<pre class="prettyprint lang-bsh linenums">#database指定需要的数据库名，然后因为我的有多个文件，就输出日志的名字.sql

/www/server/mysql/bin/mysqlbinlog --database=h5case /www/server/data/mysql-bin.000456  &gt; output000456.sql</pre>
<p><br /><br />
我的只需要指定数据库名字就行了，也可以加上开始结束时间指定下日期更精准 --start-datetime=&quot;2022-12-09 00:00:00&quot; --stop-datetime=&quot;2022-12-14 23:59:59&quot; ，具体可谷歌搜下mysqlbinlog命令<br /><br />
<br /><br />
看到有INSERT INTO写入记录就放心了<br /><br />
<br /><br />
<a target="_blank" href="https://www.xiedandan.com/content/uploadfile/202212/1cba1671093714.jpg" id="ematt:45"><img src="https://www.xiedandan.com/content/uploadfile/202212/1cba1671093714.jpg" title="点击查看原图" alt="binlog2.jpg" border="0" width="720" height="573" /></a><br /><br />
<br /><br />
3、本来是有命令直接输出sql并导入到数据库，但是我怕搞出问题，就把生成的sql文件下载到本地，在本地恢复数据库<br /><br />
生成的sql文件使用Navicat Preminum导入的时候会报错，这里我使用的是本地的phpstudy导入的<br /><br />
<br /><br />
<a target="_blank" href="https://www.xiedandan.com/content/uploadfile/202212/80f41671093150.jpg" id="ematt:43"><img src="https://www.xiedandan.com/content/uploadfile/202212/80f41671093150.jpg" title="点击查看原图" alt="binlog1.jpg" border="0" width="800" height="630" /></a><br /><br />
<br /><br />
遇到报错会返回第几行，然后定位到那里解决就好了。<br /><br />
<br /><br />
<br /><br />
<br /><br />
<br /><br />
<br /><br />
<br /><br />
<br /></p>]]></description>
    <pubDate>Thu, 15 Dec 2022 15:58:34 +0800</pubDate>
    <dc:creator>谢单单</dc:creator>
    <guid>https://www.xiedandan.com/post-25.html</guid>
</item>
<item>
    <title>使用CSS的clip-path:polygon裁剪图片斜边三角：非遮罩去掉多余的部分</title>
    <link>https://www.xiedandan.com/post-24.html</link>
    <description><![CDATA[<p>最近小程序要实现斜切效果，又不能使用遮罩，于是搜到clip-path裁切方法。<br /><br />
要实现的效果如下：<br /><br />
<a target="_blank" href="https://www.xiedandan.com/content/uploadfile/202205/f13e1651583737.jpg" id="ematt:32"><img src="https://www.xiedandan.com/content/uploadfile/202205/f13e1651583737.jpg" title="点击查看原图" alt="20220503211254.jpg" border="0" width="749" height="789" /></a><br /><br />
<br /><br />
演示效果如下：<br /></p>
<iframe width="100%" height="680" src="https://jsrun.net/5BQKp/embedded/all/light" allowfullscreen="allowfullscreen" frameborder="0">
</iframe>
<p><br /><br />
<br /><br />
原理如下：<br /><br />
<a target="_blank" href="https://www.xiedandan.com/content/uploadfile/202205/b8371651584070.png" id="ematt:34"><img src="https://www.xiedandan.com/content/uploadfile/202205/b8371651584070.png" title="点击查看原图" alt="TB2GihXoZnI8KJjSspeXXcwIpXa_!!1083656586.png" border="0" width="600" height="600" /></a><br /><br />
主要就是使用如下代码裁剪了<br /></p>
<pre class="prettyprint lang-css linenums">/*使用clip-path剪切掉多余的部分*/
clip-path: polygon(0 0, 0 0, 100% 0, 100% 0, 280px 100%, 0 100%); </pre>
<p><br /><br />
安卓小程序上显示效果<br /><br />
<a target="_blank" href="https://www.xiedandan.com/content/uploadfile/202205/b5381651584985.jpg" id="ematt:36"><img src="https://www.xiedandan.com/content/uploadfile/202205/b5381651584985.jpg" title="点击查看原图" alt="Screenshot_20220503-213324.jpg" border="0" width="1440" height="3120" /></a><br /></p>]]></description>
    <pubDate>Tue, 03 May 2022 21:07:17 +0800</pubDate>
    <dc:creator>谢单单</dc:creator>
    <guid>https://www.xiedandan.com/post-24.html</guid>
</item>
<item>
    <title>jQuery封装H5手机端滚动到底部加载更多分页，且在请求时间内结束前只执行一次</title>
    <link>https://www.xiedandan.com/post-17.html</link>
    <description><![CDATA[<p>要做需要SEO的手机网站，只切图，剩下的交给后端去对接功能。感觉终于扬眉吐气了一回~~<br /><br />
好像没做网站了，jQuery都写得有点陌生了~<br /><br />
下面贴上封装的滚动到底部加载更多的方法，请求时间只请求一次也封装好了。<br /></p>
<pre class="prettyprint lang-js linenums">const $scrollBottom = {
  num: 0,
  isScroll: true,
  scroll(callback) {
    if (!this.isScroll) return
    window.onload = e =&gt; {
      $(window).scroll(() =&gt; {
        const h = $(document.body).height();
        const c = $(document).scrollTop();
        const wh = $(window).height();

        if (Math.ceil(wh + c) &gt;= h) {

          this.num++
          if (this.num === 1) {
            //执行底部事件

            this.end()
            callback()

          }
        }
      })

    }
  },
  end() {
    this.num = 1
    this.isScroll = false
  },
  start() {
    this.num = 0
    this.isScroll = true
  }
}</pre>
<p><br /><br />
调用方法<br /></p>
<pre class="prettyprint lang-js linenums">// 开始执行滚动到底部
$scrollBottom.scroll(function () {
    // 滚动到底部了
    console.log('滚动到底部了,开始请求', );

    // 开始请求
    setTimeout(() =&gt; {
        console.log('模拟请求成功!', );

        //请求结束  重新开始检测滚动到底部 , 没数据后 不执行start()方法 或者 执行 $scrollBottom.end() 禁用检测滚动到底部
        $scrollBottom.start()
    }, 1000);

})</pre>
<p><br /><br />
<br /><br />
<br /><br />
<br /><br />
<br /><br />
<br /></p>]]></description>
    <pubDate>Wed, 28 Apr 2021 16:27:21 +0800</pubDate>
    <dc:creator>谢单单</dc:creator>
    <guid>https://www.xiedandan.com/post-17.html</guid>
</item>
<item>
    <title>微信小程序canvas 2d模式生成截图画图与设置自定义字体</title>
    <link>https://www.xiedandan.com/post-16.html</link>
    <description><![CDATA[<p>微信小程序canvas设置type=&quot;2d&quot; ，每次画图都不记得写法了，这里记录下下次好直接来复制。<br /><br />
因为都用uni-app来写微信小程序，所以下面的方法是用在uni-app工程上的，原生微信小程序写法类似<br /><br />
<br /><br />
1、在template模板中写入canvas标签，用CSS把Canvas定位出去就看不到了<br /><br />
<br /></p>
<pre class="prettyprint lang-js linenums">&lt;canvas
      type="2d"
      id="canvas"
      class="canvas"
      canvas-id="canvas"
      :style="{ width: canvasObj.w + 'px', height: canvasObj.h + 'px' }"
    &gt;&lt;/canvas&gt;</pre>
<p>2、data中定义下尺寸<br /></p>
<pre class="prettyprint lang-js linenums">data () {
  return {
    canvasObj: {
        w: 569,
        h: 822,
      },
      ctx: null,
      canvas: null,
  }
},</pre>
<p><br /><br />
3、在接口执行完成，或者mounted、onReady周期执行获取dom选择器<br /><br />
<br /></p>
<pre class="prettyprint lang-js linenums">const query = uni.createSelectorQuery()    
  query
  .select('#canvas')
  .fields({ node: true, size: true })
  .exec((res) =&gt; {
    console.log('获取到的canvas元素res', res)
    this.canvas = res[0].node
    this.canvas.width = this.canvasObj.w
    this.canvas.height = this.canvasObj.h
    this.ctx = this.canvas.getContext('2d')
   //开始画图
    this.darwAwardFn()

  })</pre>
<p><br /><br />
4、弄个下载图片的函数<br /></p>
<pre class="prettyprint lang-js linenums">getImageInfoFn(url) {

    const _this = this
    return new Promise((resolve, reject) =&gt; {
      uni.getImageInfo({
        src: url,
        success: (res) =&gt; {
          console.log('下载正确', res)
          return resolve(res)
        },
        fail: (err) =&gt; {
          console.log('下载错误err---', url, err)
          uni.hideLoading()
          return reject(err)
        },
      })
    })
  },</pre>
<p><br /><br />
5、开始画图<br /></p>
<pre class="prettyprint lang-js linenums">async darwAwardFn() {
    uni.showLoading({
      title: '生成中',
      // mask: true,
    })

    const ctx = this.ctx

    const bgObj = await this.getImageInfoFn('图片路径.jpg') //把需要的图片先都下载好
    const bgImg = this.canvas.createImage() //创建图片,与H5端的 new Image()同理
    bgImg.src = bgObj.path
    bgImg.onload = () =&gt; { //等图片加载完
      ctx.drawImage(bgImg, 0, 0, this.canvasObj.w, this.canvasObj.h)  //背景图写入
      ctx.font = '26px xieyiyi'
      ctx.textAlign = 'center'
      ctx.textBaseline = 'top'
      ctx.fillText('文字内容,使用 xieyiyi字体', 170, 300)

      //生成图片
      uni.canvasToTempFilePath({
        canvas: this.canvas, // 使用2D 需要传递的参数
        success: (res) =&gt; {
          console.log('生成的图片', res.tempFilePath)
          this.downPic = res.tempFilePath  //把生成的图片增值给需要显示的变量
          uni.hideLoading()

        },
        fail(err) {
          uni.hideLoading()
        },
      })
      // end
    }
  },</pre>
<p><br /><br />
上面Canvas里有使用自定义字体，自定义字体搞了好久都不生效，CSS里声明的@font-face无效，&nbsp;最后终于找到方法了<br /><br />
在App.vue里周期里运行下面代码下载字体，这样全局就都可用了。原生小程序在app.js里运行。<br /><br />
切记！！模拟器可能无效，在真机看效果！！！实测安卓iOS可用。<br /><br />
不想放全局的可以在需要的页面试下效果。<br /></p>
<pre class="prettyprint lang-js linenums"> wx.loadFontFace({
      family: 'xieyiyi',
      source:
        'url("字体路径.ttf")',
      global: true, //是否全局可用
      scopes: ['webview', 'native'], //重点!!!使字体在原生canvas 2d里面也可用
      success(e) {
        // console.log('success字体下载', e)
      },
      fail(err) {
        // console.log('字体下载失败', err)
      },
    })</pre>
<p><br /><br />
最终效果图是这样<br /><br />
<a target="_blank" href="https://www.xiedandan.com/content/uploadfile/202104/eea91617781223.jpg" id="ematt:28"><img src="https://www.xiedandan.com/content/uploadfile/202104/eea91617781223.jpg" title="点击查看原图" alt="wudaohuodong.jpg" border="0" width="568" height="822" /></a><br /><br />
<br /><br />
<br /><br />
<br /><br />
<br /><br />
<br /><br />
<br /><br />
<br /><br />
<br /><br />
<br /><br />
<br /><br />
<br /><br />
<br /><br />
<br /><br />
<br /><br />
<br /></p>]]></description>
    <pubDate>Wed, 07 Apr 2021 15:02:33 +0800</pubDate>
    <dc:creator>谢单单</dc:creator>
    <guid>https://www.xiedandan.com/post-16.html</guid>
</item>
<item>
    <title>uView的u-input组件在微信小程序真机报vm.handleInput is not a function错误的解决方案</title>
    <link>https://www.xiedandan.com/post-15.html</link>
    <description><![CDATA[<p>现在小程序选uni-app的比较多吧，毕竟兼容多端，同时发布字节小程序、微信小程序还是挺爽的，用uni-app就使用了社区最火uView UI框架。<br /><br />
事件起因是有个用户提交用户信息总会丢失1个字，而这时候小程序告警报大量_vm.handleInput is not a function的错误，照惯例搜索一番知道了原因，于是自测一下发现果真如此。<br /><br />
<br /><br />
<a target="_blank" href="https://www.xiedandan.com/content/uploadfile/202104/bb3e1617354570.png" id="ematt:26"><img src="https://www.xiedandan.com/content/uploadfile/202104/bb3e1617354570.png" title="点击查看原图" alt="xieyiyi-xiedandan-20210402.png" border="0" width="1385" height="1000" /></a><br /><br />
<br /><br />
最终我是这么解决的，在使用u-input组件（u-field组件应该同理）的页面加入下面方法<br /><br />
<br /></p>
<pre class="prettyprint lang-js linenums">handleInput(e) {
   this.val !== e.detail.value &amp;&amp; (this.val = e.detail.value)
},</pre>
<p><br /><br />
如果val的值和方法返回的值不一样时赋值一下，这样就解决丢失文字和报错的问题了<br /><br />
<br /><br />
当页面只有一个输入框的时候用上面的方法好解决，如果是有多个输入框就要用另外的@blur失去焦点方法了<br /><br />
<br /><br />
<strong>多个输入框修改方法1：</strong><br /><br />
给每个输入框加个@blur失去焦点事件 ， 第2个参数把变是名带过去<br /><br />
<br /></p>
<pre class="prettyprint lang-js linenums"> &lt;u-input
      v-model="value1"
      type="text"
     @blur="inputBlurFn($event, 'value1')"
/&gt;</pre>
<p><br /><br />
然后在methods里加个事件赋值下<br /></p>
<pre class="prettyprint lang-js linenums">    handleInput(e) {
      // 所有有u-input的页面都需要加个这个函数，不然会报错，报错让人很不爽
    },
    inputBlurFn(e, key) {
      // console.log('外面的输入框失去焦点', e, key)
      this[key] !== e &amp;&amp; (this[key] = e)     //不相等的时候赋值下
    },</pre>
<p><br /><br />
这样就可以了 ，但是如果多个页面有输入框这样改起来又麻烦 ，索性我直接去修改源码了<br /><br />
<br /><br />
<strong></strong><span style="white-space:normal;"><strong>多个输入框修改方法2：</strong></span><br /><br />
定位到&nbsp;&nbsp;<strong>components\uview-ui\components\u-input\u-input.vue </strong>输入框文件修改&nbsp;handleBlur 事件，在方法里加入下面代码<br /></p>
<pre class="prettyprint lang-js linenums">      if (this.defaultValue !== event.detail.value) {
        this.defaultValue = event.detail.value
        this.$emit('input', this.defaultValue)
      }</pre>
<p><br /><br />
<br /><br />
就行了，每个使用u-input的页面都需要加个 handleInput 函数防止报错。<br /><br />
<br /><br />
<br /><br />
<br /></p>]]></description>
    <pubDate>Fri, 02 Apr 2021 16:55:41 +0800</pubDate>
    <dc:creator>谢单单</dc:creator>
    <guid>https://www.xiedandan.com/post-15.html</guid>
</item>
<item>
    <title>Flutter导入安卓.jks签名包文件，用来测试微信分享</title>
    <link>https://www.xiedandan.com/post-14.html</link>
    <description><![CDATA[<p>Flutter<span style="white-space:normal;">初入坑</span>新项目开始，因为微信开放平台的密钥还在申请，就先使用已有的密钥测试下微信分享，于是就要求安卓包的签名与包名都要对应上，现在把导入已有jks文件签名的流程做个记录，方便下次取用。<br /><br />
<br /><br />
1、把jks文件放在项目目录，我是放根目录<br /><br />
<br /><br />
<a target="_blank" href="https://www.xiedandan.com/content/uploadfile/202009/78461599119209.png" id="ematt:19"><img src="https://www.xiedandan.com/content/uploadfile/202009/78461599119209.png" title="点击查看原图" alt="Flutter1.png" border="0" width="232" height="429" /></a><br /><br />
<br /><br />
2、然后在安卓android目录下创建&nbsp;key.properties&nbsp;文件，写入如下内容<br /></p>
<pre class="prettyprint lang-js linenums">storePassword = xieyiyi1011  #密码
keyPassword = xieyiyi1011 #密码
keyAlias =  xieyiyi  #别名
storeFile = ../../reward.jks  #文件路径</pre>
<p><a target="_blank" href="https://www.xiedandan.com/content/uploadfile/202009/4bcb1599120073.png" id="ematt:24"><img src="https://www.xiedandan.com/content/uploadfile/202009/4bcb1599120073.png" title="点击查看原图" alt="Flutter4.png" border="0" width="556" height="414" /></a><br /><br />
<br /><br />
3、打开&nbsp;android\app\build.gradle&nbsp;文件，记住是app下的<span style="white-space:normal;">build.gradle文件</span>，在28行左右插入下面代码<br /></p>
<pre class="prettyprint lang-js linenums">def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {keystoreProperties.load(new FileInputStream(keystorePropertiesFile))}
</pre>
<p><a target="_blank" href="https://www.xiedandan.com/content/uploadfile/202009/2cd71599119609.png" id="ematt:20"><img src="https://www.xiedandan.com/content/uploadfile/202009/2cd71599119609.png" title="点击查看原图" alt="Flutter2.png" border="0" width="767" height="234" /></a><br /><br />
<br /><br />
4、继续在build.gradle文件的60行左右，插入如下代码<br /></p>
<pre class="prettyprint lang-js linenums">signingConfigs {
        debug {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile file(keystoreProperties['storeFile'])
            storePassword keystoreProperties['storePassword']
        }
        release {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile file(keystoreProperties['storeFile'])
            storePassword keystoreProperties['storePassword']
        }
    }</pre>
<p><a target="_blank" href="https://www.xiedandan.com/content/uploadfile/202009/72be1599119618.png" id="ematt:22"><img src="https://www.xiedandan.com/content/uploadfile/202009/72be1599119618.png" title="点击查看原图" alt="Flutter3.png" border="0" width="792" height="534" /></a><br /><br />
<br /><br />
<br /><br />
这样设置debug包也会带上签名，就可以测试微信分享了<br /><br />
<br /></p>]]></description>
    <pubDate>Thu, 03 Sep 2020 15:41:00 +0800</pubDate>
    <dc:creator>谢单单</dc:creator>
    <guid>https://www.xiedandan.com/post-14.html</guid>
</item>
<item>
    <title>记录下偶尔用到的代码片断，用得少记不住</title>
    <link>https://www.xiedandan.com/post-13.html</link>
    <description><![CDATA[<p>一、VUE的事件获取默认值和传参一起<br /></p>
<pre class="prettyprint lang-js linenums">@click="funName($event , ...参数)"</pre>
<p><br /><br />
<br /><br />
二、数组对象更新不想用$set的时候，使用下面代码强制刷新下就好<br /></p>
<pre class="prettyprint lang-js linenums">this.$forceUpdate()</pre>
<p><br /><br />
三、页面定时器如果在destroyed()销毁页面的时候清除定时器，会难以维护<br /></p>
<pre class="prettyprint lang-js linenums"> data() {
    return {
      timer: null,
      num: 1,
    }
  },

  mounted() {
     this.timer = setInterval(() =&gt; {
        console.log('定时器加1', this.num++)
      }, 1000)
  },
  destroyed() {
    clearInterval(this.timer)
  },</pre>
<p>使用hook:destroyed可以把清除定时器代码写在一起，注释定时器的时候可以方便一起注释了<br /></p>
<pre class="prettyprint lang-js linenums">methods: {
    startTimer() {
      this.timer = setInterval(() =&gt; {
        console.log('定时器加1', this.num++)
      }, 1000)
      //直接在这写清除定时器方便维护
      this.$once('hook:destroyed', _ =&gt; {
        clearInterval(this.timer)
      })
    },    
  },</pre>
<p><br /><br />
<br /><br />
四、苹果新版ios系统在微信浏览器中长按图片会出现拖动事件，会使opacity<span style="display:none;" id="__kindeditor_bookmark_start_0__"></span>透明的图片显示出来，常用的是隐藏的带二维码的海报长按保存时出现拖动了。禁止图片拖动事件就好了<br /><br />
<br /><br />
JS原生写法，给img标签加上下面代码<br /></p>
<pre class="prettyprint lang-js linenums">ondragstart="return false"</pre>
<p><br /><br />
VUE写法<br /></p>
<pre class="prettyprint lang-html linenums">&lt;img  @dragstart="dragstartFn" /&gt;</pre>
<p><br /></p>
<pre class="prettyprint lang-js linenums">dragstartFn(e) {
   e.preventDefault()
   return false
},</pre>
<p><br /><br />
<br /><br />
<br /><br />
五、苹果ios微信H5里父级设置border-radius圆角后overflow: hidden失效的问题，父元素设置以下两个CSS属性<br /></p>
<pre class="prettyprint lang-css linenums">-webkit-backface-visibility: hidden;
-webkit-transform: translate3d(0, 0, 0);</pre>
<p><br /><br />
<br /><br />
<br /><br />
<br /></p>]]></description>
    <pubDate>Fri, 24 Jul 2020 16:42:13 +0800</pubDate>
    <dc:creator>谢单单</dc:creator>
    <guid>https://www.xiedandan.com/post-13.html</guid>
</item>
<item>
    <title>对不起，都是拖延症严重的我，都是凉薄的我</title>
    <link>https://www.xiedandan.com/post-12.html</link>
    <description><![CDATA[<p>[该文章已设置加密]</p>]]></description>
    <pubDate>Thu, 05 Mar 2020 23:10:42 +0800</pubDate>
    <dc:creator>谢单单</dc:creator>
    <guid>https://www.xiedandan.com/post-12.html</guid>
</item></channel>
</rss>