JSFiddle - React, Tailwind, and code Playground
by vi161
HTML
<script src="//unpkg.com/vue/dist/vue.js"></script>
<script src="//unpkg.com/[email protected]/lib/index.js"></script>
<div id="app">
<div>
<input type="text" v-show="show" placeholder="Please input" v-model="input" ref="input" autofocus></input>
<el-button @click="handleFocus">Default Button</el-button>
</div>
</div>
SCSS
@import url("//unpkg.com/[email protected]/lib/theme-default/index.css");
Babel + JSX
var Main = {
data() {
return {
input: 'Hello',
show: false
}
},
methods:{
handleFocus(){
this.show = !this.show;
}
}
}
Vue.nextTick()
.then(function () {
// DOM обновлён
this.$refs.input.$el.children[0].focus();
})
var Ctor = Vue.extend(Main)
new Ctor().$mount('#app')