Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[实习笔记] canvas 以及一些平时用到的坑与知识点 #7

Open
deligent-ant opened this issue May 29, 2018 · 0 comments
Open
Labels
Notes 笔记

Comments

@deligent-ant
Copy link
Contributor

deligent-ant commented May 29, 2018

canvas操作

  1. 关于canvas的变换矩阵
 this.sector.setTransform(
          Math.cos(s),
          Math.sin(s),
          -1 * Math.sin(s),
          Math.cos(s),
          600 - Math.cos(s) * 600 + Math.sin(s) * 600,
          600 - Math.sin(s) * 600 - Math.cos(s) * 600
        )

不改变旋转中心,
2. canvas适配,配合高清屏幕,可以将canvas的width和height放大,放大倍数看具体的设备的window.devicePixelRatio。最后在将canvas的dom的css . 大小width和height设置成ui要求的大小

关于viewport的适配

使用的是webpack,在postcss.config.js中设置好,如下:

   require('postcss-px-to-viewport')({
      viewportWidth: 750,
      viewportHeight: 1332,
      unitPrecision: 3,
      viewportUnit: 'vw',
      selectorBlackList: ['.nvw', '.hairlines'],
      minPixelValue: 1,
      mediaQuery: false
    }),
    require('postcss-viewport-units')()

#VUE踩坑
1.对象和数组变化时候,ui没监视到,没有触发一定的更新。虽然平时看文档 有见到过 还是在实践中踩坑了。所以不能直接操作对象和数组的改变,可以如下和文档一样的操作:

 

Vue.set(vm.items, indexOfItem, newValue)
   vm.$set(vm.items, indexOfItem, newValue)
vm.items.splice(indexOfItem, 1, newValue)
vm.userProfile = Object.assign({}, vm.userProfile, {
  age: 27,
  favoriteColor: 'Vue Green'
})

git 远程链接

将本地的ssh key放入git上,可以链接该git,查看ssh key:

cat ~/.ssh/id_rsa.pub

将本地的ssh key添加入远程机子

cat ~/.ssh/authoried     具体按tab  忘记是单词了哈

连接远程机子:用户名和ip

ssh xiaoyanhui@ip

收获数据库的2个技巧

  1. 因为线上和线下的数据库不用, 所以,可以定义一个alias指向对应的数据库,这样在开发代码中都
    只是写alias,如下:
 psm: 'toutiao.mysql.testdb',
 alias: 'caijing.cms.stock.read',

遇到的问题

在vue中 引入某个插件(自定义),其顶层对象是window吗,在mouted中给window添加原型链方法会 出现意外,引用错误。

@leecade leecade changed the title canva以及一些平时用到的坑与知识点 [实习笔记] canvas 以及一些平时用到的坑与知识点 Jun 1, 2018
@leecade leecade added the Notes 笔记 label Jun 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Notes 笔记
Projects
None yet
Development

No branches or pull requests

2 participants