l2d-vue

1.0.1 • Public • Published

how to use in vite

package.json
{
	"dependencies": {
		"l2d-vue": "^1.0.0"
	},
	"devDependencies": {
		"vite-plugin-html": "^3.2.0"
	}
}
<script>
/* steps 
 1 init setting
 2 init model
 3 bind events
 */
import live2d from 'l2d-vue'
onMounted(() => {
  console.log(live2d);
  live2d.l2dInitSetting({modelAPI: '/data/', modelList: json.models, waifuSize: '250x360'})
  live2d.l2dInitModel('live2d')
  live2d.l2dWaifuMouseTip((type, txt) => { // event: mouseenter&mouseleave
    console.log(type, txt);
  })
  l2dModule.l2dWaifuClick((res) => { // event: click
  	console.log(res);
  })
})
function change() {
  live2d.l2dSwitchModel()
}
</script>
<template>
<canvas id="live2d"></canvas>
</template>

vite.config.js
server: {
    proxy: {
      '/data': {
        target: 'YourLocalhost/public/',
        changeOrigin: true,
        rewrite: path => path.replace(/^\/data/, '')
      }
    }
  },

exposed

l2dInitModel l2dInitSetting l2dLoadModel l2dModelCapture l2dRandomModel l2dSwitchModel l2dWaifuClick l2dWaifuMouseTip l2d_settings

/l2d-vue/

    Package Sidebar

    Install

    npm i l2d-vue

    Weekly Downloads

    4

    Version

    1.0.1

    License

    ISC

    Unpacked Size

    205 kB

    Total Files

    5

    Last publish

    Collaborators

    • loucharon