natjs/weex-nat-media-image

undefined is not a function (near '...o.pick...')

Opened this issue · 0 comments

2018-01-04 19:00:41.093380+0800 WeexDemo[48482:2119450] [error]WXJSCoreBridge.m:146, jsLog: Unhandled promise rejection TypeError: undefined is not a function (near '...o.pick...')

environment:
Using SDWebImage (3.7.5)
Using SocketRocket (0.4.2)
Using WeexPluginLoader (0.0.1.9.1)
Using WeexSDK (0.17.0)

pod: 1.4.0.beta.1

nat-camera 0.1.6
nat-device-screen 0.1.3
nat-media-image 0.2.3
nat-modal 0.1.7
natjs@0.1.3

weexpack 0.4.7-beta.26

code:

<template>
  <div class="wrapper">
    <image
      v-for="(v, index) in phtotPaths"
      :key="index"
      :src="v" class="logo"
      @click="previewPhoto(phtotPaths, index)"
      ></image>
    <text class="title">{{ errStr }}</text>
    <text class="button" @click="pickPhoto">Pick photo</text>
  </div>
</template>

<style>
  .wrapper { align-items: center; margin-top: 120px; }
  .logo {width: 300px; height: 300px; border: 1px solid #ddd;}
  .title { padding-top:40px; padding-bottom: 40px; font-size: 48px; }
  .button {
    font-size: 36px;
    width: 280px;
    color: #41B883;
    text-align: center;
    padding-top: 25px;
    padding-bottom: 25px;
    border-width: 2px;
    border-style: solid;
    border-color: rgb(162, 217, 192);
    background-color: rgba(162, 217, 192, 0.2);
  }
</style>

<script>
  import Nat from 'natjs';

  export default {
    data: {
      phtotPaths: [
        'http://img1.vued.vanthink.cn/vued08aa73a9ab65dcbd360ec54659ada97c.png',
      ],
      errStr: '',
    },
    methods: {
      pickPhoto() {
        // take a photo
        // this.errStr = Nat.camera.captureImage;
        // Nat.camera.captureImage({}, (err, ret) => {
        //   this.phtotPath = ret.path;
        //   this.photoUrl = ret.path;
        // });
        Nat.image.pick({
            limit: 3,
            showCamera: true,
        }, (err, ret) => {
          Nat.alert(JSON.stringify(err));
          Nat.alert(JSON.stringify(ret.paths));
          this.errStr = JSON.stringify(err);
          this.errStr = JSON.stringify(ret.paths);
          this.phtotPaths = this.phtotPaths.concat(ret.paths);
        });
      },

      previewPhoto(phtotPaths, index) {
        Nat.image.preview(phtotPaths, {
            current: index,
            style: 'none'
        });
      },
    }
  }
</script>