I'm working on an ecommerce project. I have introduced the ProjectDetails component and upon saving, the browser cannot show the product image - react-redux

This is the ProductDetails.js
const ProductDetails = () => {
return (
<div className='row f-flex justify-content-around'>
<div className='col-12 col-lg-5 img-fluid' id='product_image'>
<img src='./images/logo.png' height='500' width='500'></img>
</div>
<div className='col-12 col-lg-5 mt-5'>
<h3>MARKET DAY, MOSAIC</h3>
<p id='product_id'>Product # hdoeijrokfkrenf</p>
<hr></hr>
<div className='rating-outer'>
<div className='rating-inner'></div>
</div>
<span id='no_of_reviews'>(5 reviews)</span>
<hr></hr>
<p id='product_price'>Ksh 100,000.00</p>
<div className='stockCounter d-inline'>
<span className='btn btn-danger minus'>-</span>
<input type='number' className='form-control count d-inline' value='1' readOnly></input>
<span className='btn btn-primary plus'>+</span>
</div>
<button type='button' id='cart_btn' className='btn btn-primary d-inline ml-4'>Add to cart</button>
<button type='button' id='cart_btn' className='btn btn-primary d-inline ml-4'>Buy now</button>
<hr></hr>
<h4 className='mt-2'>Description</h4>
<p>fybipsimvyuhgsivnmdufnho,vpafovmgfyuvnhifmdkolpoiuhcgtdyhusiociuhfycjsocnbms
cgbcnfmc,dp,olkmncfnmfc,ud.o,cyfunijm,fiudygbhunijmkefdyguhnijmkdf
gbhnjmk,l.oikuytgyhjsk,l.cfkiye6gvyhjkochdjk
</p>
<hr></hr>
<p id='product_seller mb-3'>Sold by: <strong>Tile and Carpet</strong> </p>
<button id='review_btn' type='button' className='btn btn-primary mt-4'
data-togle='modal' data-target='#ratingModal'> Submit Your Review</button>
<div className='row mt-2 mb-5'>
<div className='rating w-50'>
<div className='modal fade' id='ratingModal' tabIndex='1' role='dialog'
aria-labelledby='ratingModalLabel' aria-hidden='true'>
<div className='modal-dialog' role='document'>
<div className='modal-content'>
<div className='modal-header'>
<h5 className='modal-title' id='ratingModalLabel'>Submit Review</h5>
<button type='button' className='close' data-dismiss='modal' aria-label='close'>
<span aria-hidden='true'>×</span>
</button>
</div>
<div className='modal-body'>
<ul className='stars'>
<li className='star'><i className='fa fa-star'></i></li>
<li className='star'><i className='fa fa-star'></i></li>
<li className='star'><i className='fa fa-star'></i></li>
<li className='star'><i className='fa fa-star'></i></li>
</ul>
<textarea name='review' id='review' className='form-control mt-3'></textarea>
<button className='btn my-3 float-right review-btn px-4 text-white' data-dismiss='modal' aria-label='close'>Submit</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
)
}
export default ProductDetails```
This is the App.js file
import { BrowserRouter as Router, Route } from 'react-router-dom'
import ProductDetails from './components/product/ProductDetails'
<Route path="/floor" component={Floor} exact/>
<Route path="/product/:id" component={ProductDetails} exact/>
Here is the store.js
import { legacy_createStore as createStore, combineReducers, applyMiddleware } from 'redux';
import thunk from 'redux-thunk';
import { composeWithDevTools } from 'redux-devtools-extension'
import { productsReducer, productDetailsReducer } from './reducers/productReducers'
import { projectsReducer, projectDetailsReducer } from './reducers/projectReducers'
const reducer = combineReducers({
products: productsReducer,
productDetails: productDetailsReducer,
})
let initialState = {}
const middleware = [thunk];
const store = createStore(reducer, initialState, composeWithDevTools(applyMiddleware(...middleware)))
export default store;
This is the message from my console:
> Proxy error: Could not proxy request /product/images/city.jpg from
> localhost:3000 to http://127.0.0.1:4000. See
> https://nodejs.org/api/errors.html#errors_common_system_errors for
> more information (ECONNREFUSED).
Why is the browser not displaying the product image?

Related

Multiple reusable modals vue 3 - how to keep track of paging? be more in control of modal functions

I'm trying to create a reusable modal in Vue 3 using the composition API. I'm finding it difficult due to a lack of knowledge to keep track of the modals that are shown because at the end when I submit my data using Inertia with Laravel I want the errors to display on the relevant modal.
I want to be able to keep track of which modal is open. I want to be able to close specific modals and open specific modals with a method. I would like to display the modal page where errors occur. For example, page 1 of 3 contains validation errors. Or an alternative to clicking next and getting errors on the fly for the current scope?
Any suggestions are welcome.
Here is my reusable modal vue component:
<script setup>
import {onMounted, reactive, watch} from 'vue'
import {Modal} from 'bootstrap'
const modal = reactive({});
let props = defineProps({
id: {
type: String,
required: true,
},
showModal: {
type: Boolean,
default: false,
},
});
onMounted(() => {
modal.value = new Modal('#' + props.id);
})
watch(
() => props.showModal,
show => {
modal.value.show()
},
)
</script>
<template>
<teleport to="body">
<div
:id="id"
class="modal fade"
tabindex="-1"
aria-hidden="true"
>
<div class="modal-dialog modal-dialog-centered max_630">
<div class="modal-content">
<div
v-if="$slots.title"
class="modal-header"
>
<h5 class="modal-title">
<slot name="title"/>
</h5>
<a
type="button"
data-bs-dismiss="modal"
aria-label="Close"
><span
class="iconify"
data-icon="ant-design:close-outlined"
/></a>
</div>
<div
v-if="$slots.body"
class="modal-body"
>
<slot name="body"/>
</div>
<div
v-if="$slots.footer"
class="modal-footer"
>
<slot name="footer"/>
</div>
</div>
</div>
</div>
</teleport>
</template>
This is how im using the reusable modal by defining 3 of them for 3 pages of inputs and the final page being the submission:
<script setup>
import Modal from '#/Components/Modal';
import {defineExpose, ref} from 'vue'
import {useForm} from "#inertiajs/inertia-vue3";
import BreezeInput from '#/Components/Input.vue';
import BreezeLabel from '#/Components/Label.vue';
import InputError from '#/Components/InputError.vue';
import Button from '#/Components/Button';
const form = useForm({
company: {
brand_name: null,
trading_name: null,
registered_name: null,
reg_no: null,
vat_no: null,
email: null,
telephone: null,
website_url: null
},
address: {
line1: null
}
})
const submit = () => {
form.post(route('dealership.store'), {
onError: (err) => {
// form.errors
},
onSuccess: () => {
}
});
};
let props = defineProps({
showModal: {
type: Boolean,
default: false,
},
});
</script>
<template>
<Button
class="blue_bg_button"
#click="showModal = !showModal"
>
<span
class="iconify"
data-icon="dashicons:plus-alt2"
/>
{{ __('Create Dealership') }}
</Button>
<Modal :id="'page1'" :showModal="showModal">
<template #title>
Create New Dealership
</template>
<template #body>
<h6 class="font_600 mb-4">Dealership Information</h6>
<div class="row">
<div class="col-6">
<div class="form-wrapper-block mb-4">
<BreezeLabel class="form-label" for="brand_name" value="Brand Name"/>
<BreezeInput id="brand_name" type="text" class="form-control" v-model="form.company.brand_name" placeholder="Brand Name"/>
<InputError :message="form.errors['company.brand_name']"></InputError>
</div>
</div>
<div class="col-6">
<div class="form-wrapper-block mb-4">
<BreezeLabel class="form-label" for="trading_name" value="Dealership Trading Name"/>
<BreezeInput id="trading_name" type="text" class="form-control" v-model="form.company.trading_name" placeholder="Trading Name"/>
<InputError :message="form.errors['company.trading_name']"></InputError>
</div>
</div>
</div>
<div class="row">
<div class="col-6">
<div class="form-wrapper-block mb-4">
<BreezeLabel class="form-label" for="registered_name" value="Dealership Registration Name"/>
<BreezeInput id="registered_name" type="text" class="form-control" v-model="form.company.registered_name" placeholder="Dealership Registration Name"/>
<InputError :message="form.errors['company.registered_name']"></InputError>
</div>
</div>
<div class="col-6">
<div class="form-wrapper-block mb-4">
<BreezeLabel class="form-label" for="reg_no" value="Registration Number"/>
<BreezeInput id="reg_no" type="text" class="form-control" v-model="form.company.reg_no" placeholder="00/000/000"/>
<InputError :message="form.errors['company.reg_no']"></InputError>
</div>
</div>
</div>
<div class="row">
<div class="col-6">
<div class="form-wrapper-block mb-4">
<BreezeLabel class="form-label" for="vat_no" value="VAT Number"/>
<BreezeInput id="vat_no" type="text" class="form-control" v-model="form.company.vat_no" placeholder="4333455555"/>
<InputError :message="form.errors['company.vat_no']"></InputError>
</div>
</div>
<div class="col-6">
</div>
</div>
<hr>
<h6 class="font_600 mb-4">Location</h6>
<div class="form-wrapper-block mb-4">
<BreezeLabel class="form-label" for="line1" value="Address Line"/>
<BreezeInput id="line1" type="text" class="form-control" v-model="form.address.line1" placeholder="12 Harrington Street, Cape Town, Cape Town City Centre"/>
<InputError :message="form.errors['address.line1']"></InputError>
</div>
<div class="pagination-wrapper">
<div class="pagination">
<span class="active"></span>
<span></span>
<span></span>
</div>
</div>
</template>
<template #footer>
<button type="button" class="blue_bg_button" data-bs-dismiss="page1" data-bs-toggle="modal" data-bs-target="#page2">Next</button>
<button type="button" class="edit_button" data-bs-dismiss="modal">Cancel</button>
</template>
</Modal>
<Modal :id="'page2'">
<template #title>
Create New Dealership
</template>
<template #body>
<h6 class="font_600 mb-4">Dealership Contact Details</h6>
<div class="row">
<div class="col-6">
<div class="form-wrapper-block mb-4">
<BreezeLabel class="form-label" for="dealer_email" value="Dealership Email"/>
<BreezeInput id="dealer_email" type="email" class="form-control" v-model="form.company.email" placeholder="Dealership Email"/>
<InputError :message="form.errors['company.email']"></InputError>
</div>
</div>
<div class="col-6">
<div class="form-wrapper-block mb-4">
<BreezeLabel class="form-label" for="telephone" value="Contact Number"/>
<BreezeInput id="telephone" type="text" class="form-control" v-model="form.company.telephone" placeholder="012 234 6789"/>
<InputError :message="form.errors['company.telephone']"></InputError>
</div>
</div>
</div>
<div class="row">
<div class="col-6">
<div class="form-wrapper-block mb-4">
<BreezeLabel class="form-label" for="website_url" value="Dealership Website"/>
<BreezeInput id="website_url" type="text" class="form-control" v-model="form.company.website_url" placeholder="www.dealership.com"/>
<InputError :message="form.errors['company.website_url']"></InputError>
</div>
</div>
<div class="col-6">
</div>
</div>
<div class="pagination-wrapper">
<div class="pagination">
<span class="active"></span>
<span class="active"></span>
<span></span>
</div>
</div>
</template>
<template #footer>
<div class="d-flex align-items-center">
<a href="#" class="gray_7" data-bs-dismiss="modal" data-bs-toggle="modal" data-bs-target="#page1"><span class="iconify prev_ico" data-icon="ant-design:arrow-left-outlined"></span>
Previous</a>
</div>
<div>
<button type="button" class="edit_button" data-bs-dismiss="modal">Cancel</button>
<button type="button" class="blue_bg_button" data-bs-dismiss="modal" data-bs-toggle="modal" data-bs-target="#page3">Next</button>
</div>
</template>
</Modal>
<Modal :id="'page3'">
<template #title>
Create New Dealership
</template>
<template #footer>
<div class="d-flex align-items-center">
<a href="#" class="gray_7" data-bs-dismiss="modal" data-bs-toggle="modal" data-bs-target="#page2"><span class="iconify prev_ico" data-icon="ant-design:arrow-left-outlined"></span>
Previous</a>
</div>
<div>
<button type="button" class="edit_button" data-bs-dismiss="modal">Cancel</button>
<button type="submit" class="blue_bg_button" :disabled="form.processing" #click="submit()">Add dealership</button>
</div>
</template>
</Modal>
</template>

How to render Ckeditor data in next js app

Ckeditor Data
I am building a Blog with Next JS, which Fetches Data from a Laravel Rest API, I have done everything fine but when I try to fetch data from Ckeditor field it prints as it is, I have tried multiple Rich Text Markdown Packages within my app but the same problem continues. Output is shown in the Image Above.
Kindly tell me What should i do now ??
import React from 'react'
import styles from '../../styles/BlogSingle.module.css'
import Image from 'next/image'
import SidebarBlogs from './SidebarBlogs'
import { BlogsBelow } from './BlogsBelow'
export default function BlogSingle({blog, blogs}) {
return (
<>
<div className='container' id={styles.Container}>
<div className='row'>
<div className='col-xl-8 col-lg-8 col-md-4 col-sm-4'>
<div className='row'>
<h1 className={styles.BlogTitle}>{blog.title}</h1>
</div>
<div className='row'>
<Image src={blog.image.url} width={850} height={500} alt={blog.slug}></Image>
</div>
<div className='row' id={styles.PaddingBelowImage}>
<div className='col-xl-6 col-lg-6 col-md-3 col-sm-3'>
<div id={styles.AuthDet}>
<Image src={blog.created_by.profile.thumbnail} width={70} height={50} alt={blog.created_by.name}></Image>
<div className={styles.AuthTextSec}>
<p className={styles.AuthName}>{blog.created_by.name}</p>
<time dateTime='13-11-2021' className={styles.AuthTime}>{blog.created_at}</time>
</div>
</div>
</div>
<div className='col-xl-6 col-lg-6 col-md-3 col-sm-3'>
<div id={styles.AuthDet}>
<i className='bi bi-bookmark'></i>
<i className='bi bi-link-45deg'></i>
<i className='bi bi-whatsapp'></i>
<i className='bi bi-facebook'></i>
<i className='bi bi-instagram'></i>
<i className='bi bi-twitter'></i>
</div>
</div>
</div>
<div className='row' id={styles.BlogContent}>
{blog.desc}
{/* <CKEditor
editor={ Editor }
config={ editorConfiguration }
data={ blog.desc }
/> */}
</div>
</div>
<div className='col-xl-1 col-lg-1 col-md-1'>
<div className="vl"></div>
</div>
<div className='col-xl-3 col-lg-3 col-md-2 col-sm-2'>
<div className='row'>
<p className={styles.YouLike}>{"You May Also Like"}</p>
</div>
<SidebarBlogs blogs={blogs}></SidebarBlogs>
</div>
</div>
</div>
<div className={styles.HideOnMobile}>
<p>{"Featured Stories"}</p>
</div>
<hr></hr>
<BlogsBelow blogs={blogs}></BlogsBelow>

Laravel - vue.js component working locally, but not found in production

I have vue.js components in my app. This is the first time ever receiving this message in the console.
The picture where 3 boxes are shown is the local machine, where it works and shows the users info.
The next picture only show 1 out of 3 boxes, with the "example" component.
Code:
The component:
<template>
<div>
<loading-spinner v-if="!data_is_fetched"></loading-spinner>
<div v-else-if="data_is_fetched">
<!-- Modalbox -->
<div>
<div v-if="modalbox" #close="modalbox = false">
<edit-user-information-modal v-if="modalboxType === 1" #close="modalbox = false" #postSucces="fetchData()"
:student="record.user">
</edit-user-information-modal>
</div>
</div>
<div class="row justify-content-center">
<div class="col-md-6 col-sm-12">
<div class="card box-shadow border-0">
<div class="card-header bg-transparent justify-content-between d-flex align-text-center">
Min bruger
</div>
<div class="card-body">
<div class="row">
<div class="col-6">
<p><span class="font-weight-bold">Navn:</span></p>
<p><span class="font-weight-bold">Fødselsdato:</span></p>
<p><span class="font-weight-bold">Email:</span></p>
<p><span class="font-weight-bold">Telefonnummer:</span></p>
<p><span class="font-weight-bold">Brugertype:</span></p>
<p><span class="font-weight-bold">Vejnavn & husnummer:</span></p>
<p><span class="font-weight-bold">Postnummer og by:</span></p>
<p><span class="font-weight-bold">Land:</span></p>
</div>
<div class="col-6">
<p>
<span v-if="record.user.name">{{ record.user.name }}</span>
<span v-else class="font-italic">Intet navn</span>
</p>
<p>
<span v-if="record.user.birthday">{{ record.user.birthday }}</span>
<span v-else class="font-italic">Ingen fødselsdato</span>
</p>
<p>
<span v-if="record.user.email">{{ record.user.email }}</span>
<span v-else class="font-italic">Ingen email</span>
</p>
<p>
<span v-if="record.user.phone">{{ record.user.phone }}</span>
<span v-else class="font-italic">Intet telefonnummer</span>
</p>
<p>
<span v-if="record.user.role_id = 1">Elev</span>
<span v-else-if="record.user.role_id = 2">Kørelærer</span>
<span v-else-if="record.user.role_id = 3">Køreskoleadministrator</span>
<span v-else-if="record.user.role_id = 4">MitKørekort - Support</span>
<span v-else-if="record.user.role_id = 5">MitKørekort - Superbruger</span>
</p>
<p>
<span v-if="record.user.address_1">{{ record.user.address_1 }}</span>
<span v-else class="font-italic">Ingen addresse</span>
</p>
<p>
<span v-if="record.user.zip_code">{{ record.user.zip_code }}</span>
<span v-else class="font-italic">Intet postnummer</span>
</p>
<p>
<span v-if="record.user.country">{{ record.user.country }}</span>
<span v-else class="font-italic">Intet land</span>
</p>
</div>
</div>
<button class="btn btn-primary" #click="modalbox = true; modalboxType = 1">Rediger</button>
</div>
</div>
</div>
<div class="col-md-4 col-sm-12">
<div class="card box-shadow border-0">
<div class="card-header bg-transparent">Ny adgangskode?</div>
<div class="card-body text-center">
<a class="mt-2 btn btn-primary btn-block" href="/nulstil/kodeord">Nulstil min adgangskode</a>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import FormMixin from '../../FormMixin.js';
export default {
mixins: [ FormMixin ],
data() {
return {
record: {},
fetchUrl: 'v1/account/fetch',
data_is_fetched: false,
modalbox: false,
modalboxType: 0,
}
},
mounted() {
console.log('Component mounted.')
this.fetchData()
},
methods: {
fetchData() {
axios.get(this.fetchUrl)
.then(response => (
this.record = response.data
))
.finally( this.data_is_fetched = true)
},
},
}
</script>
The component registration
// Account
// Profile page
Vue.component('page-show-account', require('./pages/account/Show.vue').default);
My issue was that the server had the newest compiled files in "public" and not "public_html".
So there wasn't anything missing or wrong in the code itself, but the server didn't use the correct files.
Can you drop your code?
I guess maybe you have a problem with registering the component, maybe you did not type correct path, or etc.
My advice is to read carefully
https://v2.vuejs.org/v2/guide/components-registration.html

Theme animations don't play

I'm using ABP 2.1.2 and on a form I have some controls hidden in a <div> with an *ngIf but when the <div> is revealed the floating labels don't animate so the user's text is badly merged with the label text.
component.html
<div bsModal #createServiceProviderModal="bs-modal" class="modal fade" (onShown)="onShown()" tabindex="-1" role="dialog"
aria-labelledby="createDigitalAssetModal" aria-hidden="true" [config]="{backdrop: 'static'}">
<div class="modal-dialog">
<div #modalContent class="modal-content">
<div class="modal-header">
<button type="button" class="close" (click)="close()" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<h4 class="modal-title">
<span>{{l("CreateNewServiceProvider")}}</span>
</h4>
</div>
<div id="identify" *ngIf="step == 'identify'">
<div class="modal-body">
<div class="row clearfix">
<div class="col-sm-12">
<div class="form-group form-float">
<div class="form-line">
<input materialInput id="emailAddress" type="email" name="EmailAddress" [(ngModel)]="serviceProvider.emailAddress" required class="validate form-control">
<label for="emailAddress" class="form-label">{{l("EmailAddress")}}</label>
</div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button [disabled]="saving" type="button" class="btn btn-default waves-effect" (click)="close()">
{{l("Cancel")}}
</button>
<button class="btn btn-info waves-effect" (click)="findServiceProvider()">
{{l("Next")}}
</button>
</div>
</div>
<form *ngIf="active" #createServiceProviderForm="ngForm" id="frm_create_serviceProvider" novalidate (ngSubmit)="save()">
<div id="add" *ngIf="step == 'create'">
<div class="modal-body">
<div class="row clearfix">
<div class="col-sm-12">
<div class="form-group form-float">
<div class="form-line">
<input id="companyName" type="text" name="CompanyName" [(ngModel)]="serviceProvider.companyName" required class="validate form-control">
<label for="companyName" class="form-label">{{l("CompanyName")}}</label>
</div>
</div>
</div>
</div>
<div class="row clearfix">
<div class="col-sm-6">
<div class="form-group form-float">
<div class="form-line">
<input id="name" type="text" name="Name" [(ngModel)]="serviceProvider.name" required class="validate form-control">
<label for="name" class="form-label">{{l("Name")}}</label>
</div>
</div>
</div>
<div class="col-sm-6">
<div class="form-group form-float">
<div class="form-line">
<input id="surname" type="text" name="Surname" [(ngModel)]="serviceProvider.surname" required class="validate form-control">
<label for="surname" class="form-label">{{l("Surname")}}</label>
</div>
</div>
</div>
<div class="col-sm-6">
<div class="form-group form-float">
<div class="form-line">
<input id="emailAddress" type="text" name="emailAddress" [(ngModel)]="serviceProvider.emailAddress" disabled class="validate form-control">
<label for="emailAddress" class="form-label">{{l("EmailAddress")}}</label>
</div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button [disabled]="saving" type="button" class="btn btn-default waves-effect" (click)="close()">
{{l("Cancel")}}
</button>
<button [disabled]="!createServiceProviderForm.form.valid || saving" type="submit" class="btn btn-primary waves-effect">
{{l("Save")}}
</button>
</div>
</div>
<div id="identify" *ngIf="step == 'confirm'">
<div class="modal-body">
<span class="text-success">{{l('ServiceProviderAlreadyExists')}}</span>
<br>
<table class="table">
<tr>
<td class="col-span-3"><label class="pull-right">{{l('Name')}}</label></td>
<td>{{serviceProvider.name}}</td>
</tr>
<tr>
<td><label class="pull-right">{{l('Surname')}}</label></td>
<td>{{serviceProvider.surname}}</td>
</tr>
<tr>
<td><label class="pull-right">{{l('Company')}}</label></td>
<td>{{serviceProvider.companyName}}</td>
</tr>
<tr>
<td><label class="pull-right">{{l('Email Address')}}</label></td>
<td>{{serviceProvider.emailAddress}}</td>
</tr>
</table>
</div>
<div class="modal-footer">
<button [disabled]="saving" type="button" class="btn btn-default waves-effect" (click)="close()">
{{l("Cancel")}}
</button>
<button [disabled]="!createServiceProviderForm.form.valid || saving" type="submit" class="btn btn-primary waves-effect">
{{l("Save")}}
</button>
</div>
</div>
</form>
</div>
</div>
</div>
component.ts
import { Component, ViewChild, Injector, Output, EventEmitter, ElementRef } from '#angular/core';
import { ModalDirective } from 'ngx-bootstrap';
import { ServiceProviderServiceProxy, ServiceProviderDto } from '#shared/service-proxies/service-proxies';
import { AppComponentBase } from '#shared/app-component-base';
#Component({
selector: 'create-service-provider-modal',
templateUrl: './create-service-provider.component.html'
})
export class CreateServiceProviderComponent extends AppComponentBase {
#ViewChild('createServiceProviderModal') modal: ModalDirective;
#ViewChild('modalContent') modalContent: ElementRef;
#Output() modalSave: EventEmitter<any> = new EventEmitter<any>();
serviceProvider: ServiceProviderDto = new ServiceProviderDto({id: 0, isUser: false});
step: string = "identify";
active: boolean = false;
saving: boolean = false;
constructor(
injector: Injector,
private serviceProviderService: ServiceProviderServiceProxy,
) {
super(injector);
}
show(): void {
this.active = true;
this.modal.show();
this.serviceProvider = new ServiceProviderDto({id: 0, isUser: false});
this.step = "identify";
}
onShown(): void {
$.AdminBSB.input.activate($(this.modalContent.nativeElement));
}
save(): void {
this.saving = true;
this.serviceProviderService.create(this.serviceProvider)
.finally(() => { this.saving = false; })
.subscribe(() => {
this.notify.info(this.l('SavedSuccessfully'));
this.close();
this.modalSave.emit(null);
});
}
close(): void {
this.active = false;
this.modal.hide();
}
findServiceProvider(): void {
this.saving = true;
abp.ui.setBusy();
this.serviceProviderService.getUserAsProvider(this.serviceProvider.emailAddress)
.finally(() => {
this.saving = false;
abp.ui.clearBusy();
})
.subscribe((next) => {
console.log(next);
if (next.id !== undefined) {
this.serviceProvider = next;
this.step = "confirm";
}
else {
this.step = "create";
}
})
}
}
Issue
When this modal is displayed the variable step is set to "identify" and the first section is displayed where the user must capture the service provider's email address. When the user clicks 'Next' I check if the service provider already exists and then change step to either "create" or "confirm". When the div for creating a service provider is displayed the labels for the input don't animate
Presumably I must re-run some kind of animation script but I cannot figure out what. Please help!
I think the problem was that I needed to call onShown() after revealing the div

Call method other component in vue

How to call method other component in Vue?
I have component HeaderSearch
<template>
<form action="">
<div class="form-group">
<div class="input-group">
<span class="input-group-btn">
<button class="btn" type="button">
<i class="fa fa-search"></i>
</button>
</span>
<input type="text" #keyup="search(keyword)" v-model="keyword" class="form-control" placeholder="Search...">
</div>
</div>
</form>
</template>
<script>
export default {
data(){
return { keyword: "" };
},
methods: {
search: function(keyword){
if(keyword == ''){
// Want call method fetchPost in PostHome component here
}else{
}
}
}
}
</script>
And I have component PostHome
<template>
<div>
<div class="box r_8 box_shadow" v-for="post in posts">
<div class="box_header">
<a :href="post.url">
<h3 class="mg_bottom_10" v-text="post.title"></h3>
</a>
<small v-text="post.description"></small>
<a :href="post.url" class="box_header_readmore">Read more</a>
</div>
<div class="box_body">
<a :href="post.url" v-show="post.thumbnail">
<img :src="post.thumbnail" class="img_responsive" style="min-height: 300px;background-color: #f1f1f1;
">
</a>
</div>
<div class="box_footer" v-show="post.tags.length > 0">
<ul>
<li v-for="tag in post.tags">
<a v-text="tag.name" href="javascript:void(0)"></a>
</li>
</ul>
</div>
</div>
</div>
</template>
<script>
export default {
data(){
return {
posts: null,
}
},
methods: {
fetchPosts: function(){
var url = base_url + '/user/posts'
this.$http.get(url).then(res => {
this.posts = res.data;
});
}
},
created: function(){
this.fetchPosts();
}
}
</script>
I want when user type keyup to search then if
keyword == ''
call method fetchPost method in PostHome component
You can use Mixins if that method is reusable.
Reference: https://v2.vuejs.org/v2/guide/mixins.html

Resources