JSFiddle - React, Tailwind, and code Playground
by Theara Yuom
HTML
<script src="//unpkg.com/vue/dist/vue.js"></script>
<script src="//unpkg.com/[email protected]/lib/index.js"></script>
<div id="app">
<el-input placeholder="Please input" v-model="input" @focus="select('test')" ref="test" value="123456"></el-input>
{{input}}
</div>
SCSS
@import url("//unpkg.com/[email protected]/lib/theme-chalk/index.css");
Babel + JSX
var Main = {
data() {
return {
input: ''
}
},
methods:{
select(ref){
console.log('focus', ref)
this.$refs[ref].select()
}
}
}
var Ctor = Vue.extend(Main)
new Ctor().$mount('#app')