Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- new Vue({
- el: '#app',
- data: {
- books : [ {
- id: 99,
- title: 'C++ High Performance',
- description: 'Write code that scales across CPU registers, multi-core, and machine clusters',
- authors: 'Viktor Sehr, Björn Andrist',
- publish_year: 2018,
- price: 100000,
- image: 'vue-logo.png'
- }, {id: 100,
- title: 'Mastering Linux Security and Hardening',
- description: 'A comprehensive guide to mastering the art of preventing your Linux system from getting compromised',
- authors: 'Donald A. Tevault',
- publish_year: 2018,
- price: 125000,
- image: 'logo-linux.gif'
- }, {id: 101,
- title: 'Mastering PostgreSQL 10',
- description: 'Master the capabilities of PostgreSQL 10 to efficiently manage and maintain your database',
- authors: 'Hans-Jürgen Schönig',
- publish_year: 2016,
- price: 90000,
- image: 'logo-postgresql.jpg'
- }, {id: 102,
- title: 'Python Programming Blueprints',
- description: 'How to build useful, real-world applications in thePython programming language',
- authors: 'Daniel Furtado, Marcus Pennington',
- publish_year: 2017,
- price: 75000,
- image: 'logo-python.jpg'
- }, ],
- hasiltitle: '',
- tampilSemua: 'true',
- // tampilDetail: 'true'
- },
- methods: {
- findBook: function(event) {
- this.hasiltitle = event.target.value
- },
- // check: function() {
- // return false;
- // }
- },
- computed: {
- output: function() {
- let h = this.hasiltitle;
- let i = this.books.find(function(book) {
- return book.title === h
- });
- return i;
- }
- },
- watch: {
- output: function() {
- this.tampilSemua = !this.tampilSemua;
- console.log(this.tampilSemua);
- }
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement