12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- Page({
- data: {
- camera: "../../assets/try/camera.png"
- },
- // 拍照
- takePhoto () {
- const ctx = wx.createCameraContext();
- ctx.takePhoto({
- quality: 'high',
- success: res => {
- // 旋转图片
- var canvas = wx.createContext();
- canvas.rotate(90 * Math.PI / 180);
- canvas.drawImage(res.tempImagePath);
- wx.drawCanvas({
- canvasId: "canvas",
- success: res => this.see(res.tempImagePath)
- })
- // this.see(res.tempImagePath)
- }
- })
- },
- error (e) {
- console.log(e.detail)
- },
- // 预览
- see (data) {
- wx.previewImage({
- current: data, // 当前显示图片的http链接
- urls: [data] // 需要预览的图片http链接列表
- })
- },
- onLoad: function (options) {
- },
- onReady: function () {
- },
- onShow: function () {
- },
- onHide: function () {
- },
- onUnload: function () {
- },
- onPullDownRefresh: function () {
- },
- onReachBottom: function () {
- },
- })
|