Vue-cli&webpack&arcgis API for JS Path to the sinkhole (ii)

Source: Internet
Author: User

Background account

Sure enough, it is not so easy, so fast the sinkhole two is thick. now I want to complete a function, mobile map Click on the button, reset the map, the question is how to add this button after the map load, otherwise the map has not been loaded, the button has appeared, click on the big problem Ah! Comrade , because I am not familiar with the API, so I do not know whether the API directly provides such a button interface, so I myself on.

Realize
    1. To solve this problem, start by flipping through the API's documentation and looking for something like the Load event, which is certain,

      The Load event has a loaded property, and the loaded property becomes true when the local graph is loaded


    2. But how do you listen in Vue? If put in the mounted, the experiment will error, because that time the map object does not exist, not to mention the loaded attribute, how to do? See Vue's Watch function

Watch can listen to changes in the data, including the object properties, we can listen to the changes in the loaded to achieve the purpose of rendering the button at the time

    • So what exactly?
      • The data is modified first, the value of loaded is overloaded in the Map object, and Ishide is used to bind the button's display hidden
        • Add Watch
data () {      return {        map: {‘loaded‘‘‘},        true      }    },
 watch: {      ‘map.loaded‘function () {        if(thistrue) {          thisfalse;        }      }    },
Summarize

This again let me toss for a while, as the saying goes, road long day will fall ~
PS: All the code in the sinkhole (a) put in the GitHub address ~ everyone choose to view

Vue-cli&webpack&arcgis API for JS Path to the sinkhole (ii)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.