screen_rotation
Copied to Clipboard
<html> <head> <script type="importmap"> { "imports": { "vue": "https://unpkg.com/vue@3/dist/vue.esm-browser.js" } } </script> <body> <div id="app"> <h3>Vue Js math.min() Method</h3> <p>Get the minimum value of a property in an array of objectsin Vue Js.</p> <button @click="getMinValue">click me</button> <p>{{minPrice}}</p> </div> <script type="module"> import { createApp } from "vue"; createApp({ data() { return { arrayObj: [ { fruit: 'Apple', price: 100 }, { fruit: 'Mango', price: 50 }, { fruit: 'Orange', price: 70 }, { fruit: 'Pineapple', price: 120 }, { fruit: 'Banana', price: 20 }, ], minPrice: '' } }, methods: { getMinValue() { this.minPrice = Math.min(...this.arrayObj.map(property => property.price)) } } }).mount("#app"); </script> </body> </head> </html>