服务器

腾讯云cos对象存储css字体跨域解决方法

4203℃

在部署博客到服务器的时候,出现的字体图标显示不正常的现象。打开浏览器的控制台(F12),可以看到是字体跨域加载出现错误。Access to font at 'https://xxx.file.myqcloud.com/layui/font/iconfont.ttf?v=240' from origin 'http://daha.cc' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.原因是因为我把静态资源存放在腾讯云对象存储

前端

vue双向绑定v-model实现子组件修改数据

3212℃

版本说明Vue 2.6.12Vue-Cli 4.2.3需求说明默认情况下,我们可以使用v-model属性来实现父子组件数据双向绑定。这样当父组件数据更新时,子组件的数据也会同步更新。但是如果我们要在子组件更新数据,并且同步更新父组件数据时,就会报错。[Vue warn]: Avoid mutating a prop directly since the value will be overwritten whenever the parent component re-renders. Instead, use a data or computed property bas