怎么才能在:vue的组件中使用<script>?
GitHub上我发现了一个好用的三方库,使用代码如下:
<script type="text/javascript" src="../../third_libs/verify/js/jquery.min.js" ></script>
<script type="text/javascript" src="../../third_libs/verify/js/verify.js" ></script>
<script>
$('#mpanel4').slideVerify({
type : 2, //类型
vOffset : 5, //误差量,根据需求自行调整
vSpace : 5, //间隔
imgName : ['1.jpg', '2.jpg'],
imgSize : {
width: '400px',
height: '200px',
},
blockSize : {
width: '40px',
height: '40px',
},
barSize : {
width : '400px',
height : '40px',
},
ready : function() {
},
success : function() {
alert('验证成功,添加你自己的代码!');
//......后续操作
},
error : function() {
// alert('验证失败!');
}
});
</script>
然而在Vue的组件中怎么使用它呢?
我测试过在<template>中不能使用这些代码。
个人觉得不可以,之前做地址管理与你类似。最后解决:
或者在index.html文件直接script引入(但是不用这组件的时候也加载了)