可参考https://huaji8.top/post/live2d-plugin-2.0/选模型,模型地址 https://github.com/xiazeyu/live2d-widget-models/tree/master/packages,中文文档 https://github.com/EYHN/hexo-helper-live2d/blob/master/README.zh-CN.md
1.单个HTML页面,只需要在【页首html代码】中引入L2Dwidget.js即可。
1 2 3 4 5 6 7 8 |
|
2.vue中,先在index.html中引入
<script type="text/javascript" src="/static/live2dw/lib/L2Dwidget.min.js"></script>
再在app.vue的mounted中引入
setTimeout(()=>{
window.L2Dwidget.init({
pluginRootPath: 'static/live2dw/',//插件在站点上的根目录(相对)
pluginJsPath: 'lib/',//脚本文件相对与插件根目录路径(相对)
pluginModelPath: 'live2d-widget-model-koharu/assets/',//模型文件相对与插件根目录路径
tagMode: false,//标签模式, 是否仅替换 live2d tag标签而非插入到所有页面中
debug: false,//调试, 是否在控制台输出日志
log: false,
model: {
jsonPath: '/static/live2dw/live2d-widget-model-tororo/assets/tororo.model.json',//模板
},
display: {
position: 'right',//位置
width: 100,//宽度
height: 200,//高度
},
mobile: {
show: true,//手机上展示
},
react:{
opacity:1,//透明度
}
})
},200)
效果如下: