PHP Classes

File: frontend/js/subPagina/portfolioDetalhes.js

Recommend this page to a friend!
  Classes of Rodrigo Faustino   Micro-Blog   frontend/js/subPagina/portfolioDetalhes.js   Download  
File: frontend/js/subPagina/portfolioDetalhes.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Micro-Blog
Blog management system extensible with classes
Author: By
Last change:
Date: 2 days ago
Size: 1,085 bytes
 

Contents

Class file image Download
export const PortfolioDetalhes = { template: ` <section v-if="portfolio"> <h1>{{ portfolio.titulo }}</h1> <img :src="portfolio.imagem" alt="Imagem do portfólio"> <p>{{ portfolio.descricao_breve }}</p> <div>{{ portfolio.conteudo }}</div> </section> `, data() { return { portfolio: null }; }, created() { const slug = this.$route.params.slug; fetch(`${this.urlBase}portfolios`) .then(response => response.json()) .then(data => { this.portfolio = data.find(portfolio => this.gerarSlug(portfolio.titulo) === slug); }); }, inject: ['urlBase'], methods: { gerarSlug(titulo) { //https://developer.mozilla.org/pt-BR/docs/Web/JavaScript/Reference/Global_Objects/String/normalize //https://en.wikipedia.org/wiki/Combining_Diacritical_Marks return titulo.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/\s+/g, '-'); } } };