VUE

常用軟體,程式語言的筆記和疑問
Forum rules
盡量做到:
每一個貼子都精心編輯;
每一個疑問都得到解答。
ejsoon
Site Admin
Posts: 3919
Joined: 2016 Jan 10, 22:15

VUE refs的用法

Post by ejsoon » 2018 Nov 29, 15:49

https://www.cnblogs.com/xueweijie/p/6907676.html

Code: Select all

<div id="app">
    <input type="text" ref="input1"/>
    <button @click="add">添加</button>
</div>

Code: Select all

<script>
new Vue({
    el: "#app",
    methods:{
    add:function(){
        this.$refs.input1.value ="22"; //this.$refs.input1  减少获取dom节点的消耗
        }
    }
})
</script>

ejsoon
Site Admin
Posts: 3919
Joined: 2016 Jan 10, 22:15

VUE v-for加個key

Post by ejsoon » 2018 Dec 14, 13:58

track-by="$index"

ejsoon
Site Admin
Posts: 3919
Joined: 2016 Jan 10, 22:15

VUE axios的安裝和使用

Post by ejsoon » 2018 Dec 14, 15:38

https://blog.csdn.net/qq_39894133/artic ... s/79029272

npm install axios -S

main.js:
import axios from 'axios'
Vue.prototype.$axios = axios; //引入axios


Post Reply