Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
234 views
in Technique[技术] by (71.8m points)

javascript - load html and initialize request on VueJS component

I have the following vuejs component. I know that is a pretty simple example, but it does not load on second call i-e when I move forward from one component to second component the html and request initialized and when I back from the second component to the first component and then again move to second component then the html and request not initialize

        <template>
        <div class="page-top mb-1 mb-3 align-center clearfix">
            <h1 class="float-left"> component one </h1>

        </div>
        <div class="auto-generate-main" style="padding: 60px;">
            <div class="auto-generate-inner">
                <label for="" class="label block-label"> Amount </label>
                <div class="form-group">
                    <input type="text" id="amount" class="form-control" name="amount" v-model="form.amount" placeholder="Enter an amount." :class="{ 'is-invalid': form.errors.has('amount') }" autocomplete="off"/>
                    <has-error :form="form" field="amount"></has-error>
                </div>
            <button class="btn btn-primary float-right" @click="processToSecondComponent">Next</button>
            </div>
        </div>
    </template>

This is second component

<template>
<div>
    <div class="page-top mb-1 mb-3 clearfix"><h1 class="float-left">Second Component</h1></div>
    <div class="global-main">
      <div class="people-management-inner-content"> 
        <div id="initializeHtmlAndRequest ">
        </div>      
    </div>
</div>
<script>
<script type="text/javascript" src="https://example.test/PGWHPCPlugin.js"></script>
export default {
    data() {
        return {
            banks: [],
            form: new Form({
                amount: 0,
            }),
        };
    },

  mounted() {
  PGWHPCAcct.initialize("initializeHtmlAndRequest");
  },
  }
</script>
question from:https://stackoverflow.com/questions/65914783/load-html-and-initialize-request-on-vuejs-component

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...