一些小笔记

1. 在 Vue 文件中的 style 部分引入 less 文件或css文件
<style scoped>
	@import './../style/index.less';
</style>
2. Vue-Cli中引入jquery
安装jquery
npm install jquery@对应版本
引入

在main.js中加入 import $ from “jquery” ,用 Vue.prototype.$ = $; 注册到vue原型中

调用

如需jquery操控DOM,则在mounted中填写相关代码,在DOM未挂载前

引用第三方文件

在第三方文件中会报 jQuery is not defined 的错误,此时只需在第一行添加
import jQuery from ‘jquery’;
即可,如需在第三方文件中调用另一个第三方文件出错,则需再添加
import swipe from ‘./jquery.touchSwipe.min.js’;
(以 swiper举例,注意此时要用相对路径)即可

3.EsLint - Unexpected control character(s) in regu lar expression: \x00
// .eslintrc.js
rules: {
    "no-control-regex": 0,
 }
4.引入less文件时scoped 无效
  1. style标签添加lang="less"属性
<style scoped lang="less">
@import './../style/userpage.less';
</style>
  1. style标签添加src=“targetPath”
<style scoped lang="less" src="./../style/userpage.less">

</style>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值