Last active
June 10, 2020 18:13
-
-
Save vinnitu/d9176040ac3e9cc39ca50c71dbc4cd87 to your computer and use it in GitHub Desktop.
test vue3 use
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<button ref='button' @click='count++' v-resize='onResize'>count is {{ count }}</button> | |
</template> | |
<script> | |
export default { | |
data () { | |
return { | |
count: 8 | |
} | |
}, | |
methods: { | |
onResize ({ width, height }) { | |
console.log('onResize', { width, height }) | |
} | |
}, | |
mounted () { | |
setInterval(() => { | |
const { clientWidth: width, clientHeight: height } = this.$refs.button | |
console.log('onInterval', { width, height }) | |
}, 1000) | |
} | |
} | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id='app'></div> | |
<script type='module'> | |
import { createApp } from 'vue' | |
import App from './App.vue' | |
const app = createApp(App) | |
import VueResizeObserver from 'vue-resize-observer' | |
app.use(VueResizeObserver) | |
app.mount('#app') | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "test-vue3-vite", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"keywords": [], | |
"author": "", | |
"license": "ISC", | |
"dependencies": { | |
"vite": "^0.20.7", | |
"vue-resize-observer": "^1.0.32" | |
} | |
} |
Author
vinnitu
commented
Jun 10, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment