How does vue assign an array
This article mainly introduces how to assign array vue related knowledge, content detailed and easy to understand, simple and fast operation, has a certain reference value, I believe everyone will have a harvest after reading this article how to assign array vue, let's take a look at it.
The specific methods are as follows:
1. Assignment using reactive method
#define array
const ary = reactive([]);
#Array assignment
ary.push(... [1, 2, 3])
2. Assignment using the value method
#define array
const ary = ref([]);
#Array assignment
ary.value = [1, 2, 3]
3. Assignment using the ary.length method
#define arrays and assign values
ary.splice.apply(ary, [0, ary.length, ... [1, 2, 3]])
4. Assignment using obj method
#define array
const obj = reactive({
ary: []
})
#Array assignment
obj.ary = [1, 2, 3];
The content of this article on "how to assign array vue" is introduced here, thank you for reading! I believe everyone has a certain understanding of the knowledge of "how to assign arrays to vue." If you still want to learn more knowledge, please pay attention to the industry information channel.