mirror of
https://github.com/xxxsf/vue3-h5-template.git
synced 2025-04-05 20:35:49 +08:00
20161213/16:25 父子通信介绍
This commit is contained in:
parent
ef9fe5adf1
commit
37b97d727c
371
.idea/workspace.xml
generated
371
.idea/workspace.xml
generated
@ -1,7 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="6c3e536c-9625-47f2-a758-491a8f6d2111" name="Default" comment="" />
|
||||
<list default="true" id="6c3e536c-9625-47f2-a758-491a8f6d2111" name="Default" comment="">
|
||||
<change type="DELETED" beforePath="$PROJECT_DIR$/src/components/Hello.vue" afterPath="" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/package.json" afterPath="$PROJECT_DIR$/package.json" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/components/footer.vue" afterPath="$PROJECT_DIR$/src/components/footer.vue" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/css/common.css" afterPath="$PROJECT_DIR$/src/css/common.css" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/pages/otherPages.vue" afterPath="$PROJECT_DIR$/src/pages/otherPages.vue" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/router/index.js" afterPath="$PROJECT_DIR$/src/router/index.js" />
|
||||
</list>
|
||||
<ignored path="Vue2-SPA2.iws" />
|
||||
<ignored path=".idea/workspace.xml" />
|
||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||
@ -20,11 +28,65 @@
|
||||
</component>
|
||||
<component name="FileEditorManager">
|
||||
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
|
||||
<file leaf-file-name="App.vue" pinned="false" current-in-tab="true">
|
||||
<file leaf-file-name="App.vue" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/App.vue">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="228">
|
||||
<caret line="12" column="0" lean-forward="false" selection-start-line="12" selection-start-column="0" selection-end-line="12" selection-end-column="0" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="index.js" pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/src/router/index.js">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="399">
|
||||
<caret line="21" column="19" lean-forward="true" selection-start-line="21" selection-start-column="19" selection-end-line="21" selection-end-column="19" />
|
||||
<caret line="21" column="5" lean-forward="false" selection-start-line="21" selection-start-column="5" selection-end-line="21" selection-end-column="5" />
|
||||
<folding>
|
||||
<element signature="n#!!doc" expanded="true" />
|
||||
<element signature="e#15#36#0" expanded="true" />
|
||||
<element signature="e#134#172#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="otherPages2.vue" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/pages/otherPages2.vue">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="361">
|
||||
<caret line="19" column="18" lean-forward="false" selection-start-line="19" selection-start-column="18" selection-end-line="19" selection-end-column="18" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="otherPages.vue" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/pages/otherPages.vue">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="76">
|
||||
<caret line="4" column="39" lean-forward="true" selection-start-line="4" selection-start-column="39" selection-end-line="4" selection-end-column="39" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="thirdcomponent.vue" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/components/thirdcomponent.vue">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="76">
|
||||
<caret line="4" column="0" lean-forward="true" selection-start-line="4" selection-start-column="0" selection-end-line="4" selection-end-column="0" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="secondcomponent.vue" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/components/secondcomponent.vue">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="228">
|
||||
<caret line="12" column="16" lean-forward="true" selection-start-line="12" selection-start-column="16" selection-end-line="12" selection-end-column="16" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
@ -34,7 +96,7 @@
|
||||
<entry file="file://$PROJECT_DIR$/src/pages/news.vue">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="171">
|
||||
<caret line="9" column="0" lean-forward="true" selection-start-line="9" selection-start-column="0" selection-end-line="9" selection-end-column="0" />
|
||||
<caret line="9" column="0" lean-forward="false" selection-start-line="9" selection-start-column="0" selection-end-line="9" selection-end-column="0" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
@ -55,8 +117,8 @@
|
||||
<file leaf-file-name="footer.vue" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/components/footer.vue">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="380">
|
||||
<caret line="22" column="9" lean-forward="true" selection-start-line="22" selection-start-column="9" selection-end-line="22" selection-end-column="9" />
|
||||
<state relative-caret-position="418">
|
||||
<caret line="22" column="9" lean-forward="false" selection-start-line="22" selection-start-column="9" selection-end-line="22" selection-end-column="9" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
@ -66,7 +128,7 @@
|
||||
<entry file="file://$PROJECT_DIR$/src/pages/index.vue">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="646">
|
||||
<caret line="34" column="14" lean-forward="true" selection-start-line="34" selection-start-column="14" selection-end-line="34" selection-end-column="14" />
|
||||
<caret line="34" column="14" lean-forward="false" selection-start-line="34" selection-start-column="14" selection-end-line="34" selection-end-column="14" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
@ -101,6 +163,8 @@
|
||||
<option value="$PROJECT_DIR$/src/pages/otherPages.vue" />
|
||||
<option value="$PROJECT_DIR$/src/pages/index.vue" />
|
||||
<option value="$PROJECT_DIR$/src/pages/news.vue" />
|
||||
<option value="$PROJECT_DIR$/src/components/thirdcomponent.vue" />
|
||||
<option value="$PROJECT_DIR$/src/pages/otherPages2.vue" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
@ -119,10 +183,10 @@
|
||||
<sorting>DEFINITION_ORDER</sorting>
|
||||
</component>
|
||||
<component name="ProjectFrameBounds">
|
||||
<option name="x" value="284" />
|
||||
<option name="y" value="34" />
|
||||
<option name="x" value="325" />
|
||||
<option name="y" value="49" />
|
||||
<option name="width" value="1499" />
|
||||
<option name="height" value="925" />
|
||||
<option name="height" value="928" />
|
||||
</component>
|
||||
<component name="ProjectView">
|
||||
<navigator currentView="ProjectPane" proportions="" version="1">
|
||||
@ -139,27 +203,25 @@
|
||||
<foldersAlwaysOnTop value="true" />
|
||||
</navigator>
|
||||
<panes>
|
||||
<pane id="Scratches" />
|
||||
<pane id="Scope" />
|
||||
<pane id="ProjectPane">
|
||||
<subPane>
|
||||
<PATH>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="Vue2-SPA2" />
|
||||
<option name="myItemId" value="VUE2-SPA-Tutorial" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="Vue2-SPA2" />
|
||||
<option name="myItemId" value="VUE2-SPA-Tutorial" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
</PATH>
|
||||
<PATH>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="Vue2-SPA2" />
|
||||
<option name="myItemId" value="VUE2-SPA-Tutorial" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="Vue2-SPA2" />
|
||||
<option name="myItemId" value="VUE2-SPA-Tutorial" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
@ -169,11 +231,11 @@
|
||||
</PATH>
|
||||
<PATH>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="Vue2-SPA2" />
|
||||
<option name="myItemId" value="VUE2-SPA-Tutorial" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="Vue2-SPA2" />
|
||||
<option name="myItemId" value="VUE2-SPA-Tutorial" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
@ -187,10 +249,12 @@
|
||||
</PATH>
|
||||
</subPane>
|
||||
</pane>
|
||||
<pane id="Scope" />
|
||||
<pane id="Scratches" />
|
||||
</panes>
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
|
||||
<property name="last_opened_file_path" value="$PROJECT_DIR$/../ziranmeng-front" />
|
||||
<property name="WebServerToolWindowFactoryState" value="false" />
|
||||
<property name="HbShouldOpenHtmlAsHb" value="" />
|
||||
<property name="settings.editor.selected.configurable" value="preferences.general" />
|
||||
@ -289,14 +353,16 @@
|
||||
<workItem from="1481074149722" duration="6050000" />
|
||||
<workItem from="1481080295306" duration="2328000" />
|
||||
<workItem from="1481087334416" duration="4410000" />
|
||||
<workItem from="1481506088043" duration="2523000" />
|
||||
<workItem from="1481593414151" duration="10000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TimeTrackingManager">
|
||||
<option name="totallyTimeSpent" value="14096000" />
|
||||
<option name="totallyTimeSpent" value="16629000" />
|
||||
</component>
|
||||
<component name="ToolWindowManager">
|
||||
<frame x="284" y="34" width="1499" height="925" extended-state="0" />
|
||||
<frame x="325" y="49" width="1499" height="928" extended-state="0" />
|
||||
<editor active="true" />
|
||||
<layout>
|
||||
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.15947981" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
|
||||
@ -305,7 +371,7 @@
|
||||
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="npm" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
|
||||
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3279099" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3263506" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
|
||||
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
|
||||
@ -337,6 +403,134 @@
|
||||
<watches-manager />
|
||||
</component>
|
||||
<component name="editorHistoryManager">
|
||||
<entry file="file://$PROJECT_DIR$/src/App.vue">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="228">
|
||||
<caret line="12" column="0" lean-forward="true" selection-start-line="12" selection-start-column="0" selection-end-line="12" selection-end-column="0" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/router/index.js">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="0">
|
||||
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
|
||||
<folding>
|
||||
<element signature="n#!!doc" expanded="true" />
|
||||
<element signature="e#15#36#0" expanded="true" />
|
||||
<element signature="e#134#172#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/pages/otherPages2.vue">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="361">
|
||||
<caret line="19" column="18" lean-forward="true" selection-start-line="19" selection-start-column="18" selection-end-line="19" selection-end-column="18" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/pages/otherPages.vue">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="76">
|
||||
<caret line="4" column="39" lean-forward="true" selection-start-line="4" selection-start-column="39" selection-end-line="4" selection-end-column="39" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/components/thirdcomponent.vue">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="76">
|
||||
<caret line="4" column="0" lean-forward="true" selection-start-line="4" selection-start-column="0" selection-end-line="4" selection-end-column="0" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/components/secondcomponent.vue">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="228">
|
||||
<caret line="12" column="16" lean-forward="true" selection-start-line="12" selection-start-column="16" selection-end-line="12" selection-end-column="16" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/pages/news.vue">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="171">
|
||||
<caret line="9" column="0" lean-forward="false" selection-start-line="9" selection-start-column="0" selection-end-line="9" selection-end-column="0" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/main.js">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="0">
|
||||
<caret line="0" column="7" lean-forward="false" selection-start-line="0" selection-start-column="7" selection-end-line="0" selection-end-column="7" />
|
||||
<folding>
|
||||
<element signature="e#11#32#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/components/footer.vue">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="418">
|
||||
<caret line="22" column="9" lean-forward="false" selection-start-line="22" selection-start-column="9" selection-end-line="22" selection-end-column="9" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/pages/index.vue">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="646">
|
||||
<caret line="34" column="14" lean-forward="false" selection-start-line="34" selection-start-column="14" selection-end-line="34" selection-end-column="14" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/App.vue">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="0">
|
||||
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/pages/news.vue">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="171">
|
||||
<caret line="9" column="0" lean-forward="true" selection-start-line="9" selection-start-column="0" selection-end-line="9" selection-end-column="0" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/main.js">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="0">
|
||||
<caret line="0" column="7" lean-forward="false" selection-start-line="0" selection-start-column="7" selection-end-line="0" selection-end-column="7" />
|
||||
<folding>
|
||||
<element signature="e#11#32#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/components/footer.vue">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="418">
|
||||
<caret line="22" column="9" lean-forward="true" selection-start-line="22" selection-start-column="9" selection-end-line="22" selection-end-column="9" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/pages/index.vue">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="646">
|
||||
<caret line="34" column="14" lean-forward="true" selection-start-line="34" selection-start-column="14" selection-end-line="34" selection-end-column="14" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/pages/otherPages.vue">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="285">
|
||||
@ -350,7 +544,6 @@
|
||||
<state relative-caret-position="152">
|
||||
<caret line="10" column="0" lean-forward="true" selection-start-line="10" selection-start-column="0" selection-end-line="10" selection-end-column="0" />
|
||||
<folding>
|
||||
<element signature="n#!!doc" expanded="false" />
|
||||
<element signature="e#11#32#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
@ -379,7 +572,7 @@
|
||||
<folding>
|
||||
<element signature="n#!!doc" expanded="true" />
|
||||
<element signature="e#15#36#0" expanded="true" />
|
||||
<element signature="e#134#187#0" expanded="true" />
|
||||
<element signature="e#134#172#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
@ -389,7 +582,6 @@
|
||||
<state relative-caret-position="304">
|
||||
<caret line="19" column="6" lean-forward="true" selection-start-line="19" selection-start-column="6" selection-end-line="19" selection-end-column="6" />
|
||||
<folding>
|
||||
<element signature="n#!!doc" expanded="false" />
|
||||
<element signature="e#11#32#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
@ -411,14 +603,7 @@
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/components/Hello.vue">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="133">
|
||||
<caret line="7" column="9" lean-forward="false" selection-start-line="7" selection-start-column="9" selection-end-line="7" selection-end-column="9" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/components/Hello.vue" />
|
||||
<entry file="file://$PROJECT_DIR$/src/pages/otherPages.vue">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="228">
|
||||
@ -432,7 +617,6 @@
|
||||
<state split_layout="SPLIT">
|
||||
<first_editor relative-caret-position="0">
|
||||
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
|
||||
<folding />
|
||||
</first_editor>
|
||||
<second_editor />
|
||||
</state>
|
||||
@ -443,7 +627,6 @@
|
||||
<state relative-caret-position="266">
|
||||
<caret line="16" column="21" lean-forward="false" selection-start-line="16" selection-start-column="21" selection-end-line="16" selection-end-column="21" />
|
||||
<folding>
|
||||
<element signature="n#!!doc" expanded="false" />
|
||||
<element signature="e#11#32#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
@ -457,14 +640,7 @@
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/components/Hello.vue">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="361">
|
||||
<caret line="19" column="17" lean-forward="false" selection-start-line="19" selection-start-column="17" selection-end-line="19" selection-end-column="17" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/components/Hello.vue" />
|
||||
<entry file="file://$PROJECT_DIR$/src/pages/header.vue" />
|
||||
<entry file="file://$PROJECT_DIR$/src/json/test.json">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
@ -474,35 +650,25 @@
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/README.md">
|
||||
<provider editor-type-id="text-editor">
|
||||
<state relative-caret-position="95">
|
||||
<caret line="5" column="0" lean-forward="true" selection-start-line="5" selection-start-column="0" selection-end-line="5" selection-end-column="0" />
|
||||
</state>
|
||||
</provider>
|
||||
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
|
||||
<state split_layout="SPLIT">
|
||||
<first_editor relative-caret-position="0">
|
||||
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
|
||||
<folding />
|
||||
</first_editor>
|
||||
<second_editor />
|
||||
</state>
|
||||
</provider>
|
||||
<provider editor-type-id="text-editor">
|
||||
<state relative-caret-position="95">
|
||||
<caret line="5" column="0" lean-forward="true" selection-start-line="5" selection-start-column="0" selection-end-line="5" selection-end-column="0" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/components/Hello.vue">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="133">
|
||||
<caret line="7" column="25" lean-forward="true" selection-start-line="7" selection-start-column="25" selection-end-line="7" selection-end-column="25" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/components/Hello.vue" />
|
||||
<entry file="file://$PROJECT_DIR$/src/css/common.css">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="-336">
|
||||
<caret line="11" column="40" lean-forward="false" selection-start-line="11" selection-start-column="40" selection-end-line="11" selection-end-column="40" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
@ -510,58 +676,29 @@
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="190">
|
||||
<caret line="10" column="55" lean-forward="false" selection-start-line="10" selection-start-column="55" selection-end-line="10" selection-end-column="55" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/pages/test.vue">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="133">
|
||||
<caret line="7" column="0" lean-forward="false" selection-start-line="7" selection-start-column="0" selection-end-line="11" selection-end-column="8" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/pages/test.vue" />
|
||||
<entry file="file://$PROJECT_DIR$/src/components/header.vue">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="342">
|
||||
<caret line="18" column="5" lean-forward="true" selection-start-line="18" selection-start-column="5" selection-end-line="18" selection-end-column="5" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/pages/otherPages.vue">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="95">
|
||||
<caret line="5" column="0" lean-forward="true" selection-start-line="5" selection-start-column="0" selection-end-line="5" selection-end-column="0" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/router/index.js">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="323">
|
||||
<caret line="17" column="21" lean-forward="false" selection-start-line="17" selection-start-column="21" selection-end-line="17" selection-end-column="21" />
|
||||
<folding>
|
||||
<element signature="n#!!doc" expanded="true" />
|
||||
<element signature="e#15#36#0" expanded="true" />
|
||||
<element signature="e#134#187#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/pages/index.vue">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="646">
|
||||
<caret line="34" column="14" lean-forward="true" selection-start-line="34" selection-start-column="14" selection-end-line="34" selection-end-column="14" />
|
||||
<caret line="34" column="14" lean-forward="false" selection-start-line="34" selection-start-column="14" selection-end-line="34" selection-end-column="14" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/components/footer.vue">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="380">
|
||||
<caret line="22" column="9" lean-forward="true" selection-start-line="22" selection-start-column="9" selection-end-line="22" selection-end-column="9" />
|
||||
<state relative-caret-position="418">
|
||||
<caret line="22" column="9" lean-forward="false" selection-start-line="22" selection-start-column="9" selection-end-line="22" selection-end-column="9" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
@ -579,18 +716,62 @@
|
||||
<entry file="file://$PROJECT_DIR$/src/pages/news.vue">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="171">
|
||||
<caret line="9" column="0" lean-forward="true" selection-start-line="9" selection-start-column="0" selection-end-line="9" selection-end-column="0" />
|
||||
<caret line="9" column="0" lean-forward="false" selection-start-line="9" selection-start-column="0" selection-end-line="9" selection-end-column="0" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/components/secondcomponent.vue">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="228">
|
||||
<caret line="12" column="16" lean-forward="true" selection-start-line="12" selection-start-column="16" selection-end-line="12" selection-end-column="16" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/components/thirdcomponent.vue">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="76">
|
||||
<caret line="4" column="0" lean-forward="true" selection-start-line="4" selection-start-column="0" selection-end-line="4" selection-end-column="0" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/pages/otherPages.vue">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="76">
|
||||
<caret line="4" column="39" lean-forward="true" selection-start-line="4" selection-start-column="39" selection-end-line="4" selection-end-column="39" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/pages/otherPages2.vue">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="361">
|
||||
<caret line="19" column="18" lean-forward="false" selection-start-line="19" selection-start-column="18" selection-end-line="19" selection-end-column="18" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/App.vue">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="399">
|
||||
<caret line="21" column="19" lean-forward="true" selection-start-line="21" selection-start-column="19" selection-end-line="21" selection-end-column="19" />
|
||||
<state relative-caret-position="228">
|
||||
<caret line="12" column="0" lean-forward="false" selection-start-line="12" selection-start-column="0" selection-end-line="12" selection-end-column="0" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/router/index.js">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="399">
|
||||
<caret line="21" column="5" lean-forward="false" selection-start-line="21" selection-start-column="5" selection-end-line="21" selection-end-column="5" />
|
||||
<folding>
|
||||
<element signature="n#!!doc" expanded="true" />
|
||||
<element signature="e#15#36#0" expanded="true" />
|
||||
<element signature="e#134#172#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</component>
|
||||
</project>
|
@ -50,4 +50,4 @@
|
||||
"node": ">= 4.0.0",
|
||||
"npm": ">= 3.0.0"
|
||||
}
|
||||
}
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
|
||||
<!-- 需要组件再去使用 -->
|
||||
|
||||
<!--
|
||||
<template>
|
||||
<div class="hello">
|
||||
<h1>{{ msg }}</h1>
|
||||
<h2>Router Links</h2>
|
||||
<ul>
|
||||
<li><router-link to="/index">点我跳转到第一页</router-link></li>
|
||||
<li><router-link to="/second">点我跳转到第二页</router-link></li>
|
||||
</ul>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'hello',
|
||||
data () {
|
||||
return {
|
||||
msg: 'Welcome to Your Vue.js App',
|
||||
test: 'test'
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
h1{
|
||||
color: red;
|
||||
}
|
||||
</style>
|
||||
-->
|
@ -10,7 +10,7 @@
|
||||
<router-link to="/second">menu3</router-link>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<router-link to="/second">menu4</router-link>
|
||||
<router-link to="/third">menu4</router-link>
|
||||
</div>
|
||||
</footer>
|
||||
</template>
|
||||
|
36
src/components/secondcomponent.vue
Normal file
36
src/components/secondcomponent.vue
Normal file
@ -0,0 +1,36 @@
|
||||
<template>
|
||||
<div class="hello">
|
||||
<h4>这是子组件</h4>
|
||||
<p>这是<span>来自父组件</span>的数据:{{myMessage}}</p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'child',
|
||||
props: [
|
||||
'myMessage',
|
||||
],
|
||||
// mounted(){
|
||||
// console.log("子组件打印:",this.myMessage);
|
||||
// }
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.hello{
|
||||
margin-top: 30px;
|
||||
}
|
||||
h4,p{
|
||||
color: #41b883;;
|
||||
text-align: left;
|
||||
font-size: 20px;
|
||||
}
|
||||
p{
|
||||
font-size: 12px;
|
||||
}
|
||||
span{
|
||||
color: #35495e;
|
||||
}
|
||||
</style>
|
||||
|
32
src/components/thirdcomponent.vue
Normal file
32
src/components/thirdcomponent.vue
Normal file
@ -0,0 +1,32 @@
|
||||
<template>
|
||||
<div class="thirdComponent">
|
||||
<button v-on:click="increment">{{ counter }}</button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'button-counter',
|
||||
data () {
|
||||
return {
|
||||
counter: 0
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
increment: function () {
|
||||
this.counter += 1
|
||||
this.$emit('increment')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.thirdComponent{
|
||||
display: inline-block;
|
||||
}
|
||||
button{
|
||||
color: #41b883;
|
||||
border-color: #41b883;
|
||||
}
|
||||
</style>
|
@ -14,7 +14,7 @@ a{ text-decoration:none; outline: none;}
|
||||
a:hover{ text-decoration: none; }
|
||||
a:active, a:focus{ outline:none; }
|
||||
b{ font-weight: normal; }
|
||||
input ,button{ border: none; outline: none;}
|
||||
/*input ,button{ border: none; outline: none;}*/
|
||||
input:not([type="radio"]){appearance:none;-webkit-appearance:none;-o-appearance:none;-moz-appearance:none;}
|
||||
button:active{
|
||||
transform:scale(0.9);
|
||||
@ -45,20 +45,11 @@ button{
|
||||
background: none;
|
||||
}
|
||||
|
||||
|
||||
@font-face {
|
||||
/*font-family: "iconfont";*/
|
||||
/*src: require('iconfont.woff') format('woff'),*/
|
||||
/*require('iconfont.ttf') format('truetype'),*/
|
||||
/*require('iconfont.svg#iconfont') format('svg');*/
|
||||
.text-center{
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.iconfont {
|
||||
font-family:"iconfont" !important;
|
||||
font-style:normal;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-webkit-text-stroke-width: 0.2px;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
.container{
|
||||
padding: 0 10px;
|
||||
}
|
||||
|
||||
[v-cloak] {
|
||||
|
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="container">
|
||||
<h1>{{msg}}</h1>
|
||||
<button v-on:click="fn2()">点我看控制台</button>
|
||||
<button v-on:click="fn1()">点我看控制台</button>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
@ -33,31 +33,23 @@
|
||||
fn1: function(){
|
||||
console.log("这是点击事件!");
|
||||
},
|
||||
fn2: function(){
|
||||
console.log("点击事件2");
|
||||
}
|
||||
// fn2: function(){
|
||||
// console.log("点击事件2");
|
||||
// }
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
h1{
|
||||
font-size: 30px;
|
||||
text-align: center;
|
||||
}
|
||||
h4{
|
||||
font-size: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
p,spa{
|
||||
font-size: 16px;
|
||||
text-align: center;
|
||||
font-size: 22px;
|
||||
margin-bottom: 60px;
|
||||
font-weight: 400;
|
||||
}
|
||||
button{
|
||||
background: orange;
|
||||
display: block;
|
||||
margin: 80px auto;
|
||||
color: #fff;
|
||||
line-height: 30px;
|
||||
display: block;
|
||||
margin: 0 auto;
|
||||
line-height: 30px;
|
||||
/*margin: 60px auto;*/
|
||||
}
|
||||
</style>
|
||||
|
@ -1,95 +1,12 @@
|
||||
<template>
|
||||
<h4>啥玩意儿?</h4>
|
||||
<h4 class="news-tit">啥玩意儿?</h4>
|
||||
{{lifecycle}}
|
||||
</template>
|
||||
|
||||
<!-- 下面您就随便看看 帮助理解vue的生命周期 -->
|
||||
<script>
|
||||
|
||||
var lifecycle = []; //为了描述生命周期, 在 canActivate 阶段 还没有 this.lifecycle
|
||||
|
||||
module.exports = {
|
||||
//props: ['父组建传的值'],
|
||||
data:function(){
|
||||
lifecycle.push("data");
|
||||
return {
|
||||
msg: '各个阶段,可以查看控制台输出,message from my-views',
|
||||
title:'my_views',
|
||||
lifecycle: lifecycle
|
||||
}
|
||||
},
|
||||
//这里才是route的生存周期
|
||||
route:{
|
||||
//waitForData: true, //数据加载完毕后再切换试图,也就是 点击之后先没反应,然后数据加载完,再出发过渡效果
|
||||
canActivate:function(transition){
|
||||
//canActivate阶段,可以做一些用户验证的事情
|
||||
lifecycle.push("route.canActivate <a href='http://vuejs.github.io/vue-router/zh-cn/pipeline/can-activate.html'>在验证阶段,当一个组件将要被切入的时候被调用。</a>");
|
||||
return true;
|
||||
},
|
||||
activate:function(transition){
|
||||
//console.log('active');
|
||||
this.lifecycle.push("route.activate <a href='http://vuejs.github.io/vue-router/zh-cn/pipeline/data.html'>在激活阶段被调用,在 activate 被断定( resolved ,指该函数返回的 promise 被 resolve )。用于加载和设置当前组件的数据。</a>");
|
||||
// this.$root.$set('header',this.title);
|
||||
|
||||
transition.next();
|
||||
//此方法结束后,api会调用afterActivate 方法
|
||||
//在aftefActivate中 会给组件添加 $loadingRouteData 属性 并设置为true
|
||||
},
|
||||
data: function(transition) {
|
||||
var _this = this;
|
||||
|
||||
this.lifecycle.push("route.data <a href='http://vuejs.github.io/vue-router/zh-cn/pipeline/data.html'>在激活阶段被调用,在 activate 被断定( resolved ,指该函数返回的 promise 被 resolve )。用于加载和设置当前组件的数据</a>");
|
||||
|
||||
// 说明之前请求过 则不用再请求了
|
||||
if(this.$root.myViewsData){
|
||||
this.$data = this.$root.myViewsData;
|
||||
transition.next();
|
||||
console.log('已经请求过了不再请求数据');
|
||||
return;
|
||||
}
|
||||
|
||||
//将数据同步到根节点
|
||||
this.$root.myViewsData = this.$data;
|
||||
setTimeout(function(){
|
||||
//这里 _this.$loadingRouteData 是 true
|
||||
transition.next({msg:'加载后的数据'});
|
||||
//在调用完transition.next 后,_this.$loadingRouteData 为 false
|
||||
}.bind(this),4000);
|
||||
},
|
||||
canDeactivate:function(transition){
|
||||
this.lifecycle.push("route.data <a href='http://vuejs.github.io/vue-router/zh-cn/pipeline/can-deactivate.html'>在验证阶段,当一个组件将要被切出的时候被调用。</a>");
|
||||
transition.next();
|
||||
},
|
||||
deactivate: function (transition) {
|
||||
this.lifecycle.push("route.deactivate <a href='http://vuejs.github.io/vue-router/zh-cn/pipeline/deactivate.html'>在激活阶段,当一个组件将要被禁用和移除之时被调用。</a>");
|
||||
this.lifecycle = [];
|
||||
transition.next();
|
||||
}
|
||||
},
|
||||
|
||||
created:function(){
|
||||
this.lifecycle.push("created <a href='http://cn.vuejs.org/api/options.html#created'>在实例被创建的时候同步调用。在这个阶段,实例已经完成了包含以下内容的准备工作:数据观察,计算属性,方法,以及事件回调。但 DOM 编译还没开始,vm.$el 此时尚不可用。</a>");
|
||||
},
|
||||
beforeCompile:function(){
|
||||
this.lifecycle.push("beforeCompile <a href='http://cn.vuejs.org/api/options.html#beforeCompile'>在编译开始之前调用。</a>");
|
||||
},
|
||||
compiled:function(){
|
||||
this.lifecycle.push("compiled <a href='http://cn.vuejs.org/api/options.html#compiled'>在编译完成后调用。在这个阶段,所有的指令都已经完成绑定,数据变化会触发DOM更新。但此时尚不能保证 $el 已经被插入到DOM中。</a>");
|
||||
},
|
||||
ready:function(){
|
||||
this.lifecycle.push("ready <a href='http://cn.vuejs.org/api/options.html#ready'>在编译完成后并且 $el 第一次插入文档时调用,也就是刚好在第一次 attached 钩子之后调用。注意只有通过指令或 Vue 实例方法,比如 $appendTo() 插入才会触发 ready。</a>");
|
||||
},
|
||||
attached:function(){
|
||||
this.lifecycle.push("attached <a href='http://cn.vuejs.org/api/options.html#attached'>当 vm.$el 被一个指令或是 vm 实例方法(例如$appendTo())插入到DOM里的时候调用。注意直接操作 vm.$el 不会触发这个事件。</a>");
|
||||
},
|
||||
detached:function(){
|
||||
this.lifecycle.push("detached <a href='http://cn.vuejs.org/api/options.html#detached'>当 vm.$el 被一个指令或是 vm 实例方法从 DOM 里移除的时候调用。注意直接操作 vm.$el 不会触发这个事件。</a>");
|
||||
},
|
||||
beforeDestroy:function(){
|
||||
this.lifecycle.push("beforeDestroy <a href='http://cn.vuejs.org/api/options.html#beforeDestroy'>在一个 Vue 实例被销毁之前调用。这个时候,实例的绑定和指令仍工作正常。</a>");
|
||||
},
|
||||
destroyed:function(){
|
||||
this.lifecycle.push("destroyed <a href='http://cn.vuejs.org/api/options.html#destroyed'>在一个 Vue 实例被销毁之后调用。当这个钩子被调用时,该 Vue 实例的所有指令都已经被解除绑定,所有子实例也已经被销毁。注意如果有一个离开过渡效果,destroyed 会在过渡效果结束之后才被调用。</a>");
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
.news-tit{
|
||||
font-size: 18px;
|
||||
margin-top: 60px;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
|
@ -1,15 +1,47 @@
|
||||
<template>
|
||||
<div id="secondcomponent">
|
||||
<h4>这是来自其他路由的内容!</h4>
|
||||
<div class="container">
|
||||
|
||||
<!-- 父组件内容 -->
|
||||
<h4>这是父组件</h4>
|
||||
<p>这是父组件正在渲染的数据:{{parentMsg}}</p>
|
||||
<input type="" v-model="parentMsg" autofocus="autofocus" placeholder="type something">
|
||||
|
||||
<!-- 子组件内容 -->
|
||||
<tochild :my-message="parentMsg"></tochild>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
test: 'hello'
|
||||
}
|
||||
}
|
||||
}
|
||||
import tochild from '../components/secondcomponent.vue'
|
||||
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
parentMsg: ''
|
||||
}
|
||||
},
|
||||
components: { // 挂载组件
|
||||
tochild
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
h4,p{
|
||||
color: #35495e;
|
||||
text-align: left;
|
||||
font-size: 20px;
|
||||
}
|
||||
p{
|
||||
font-size: 14px;
|
||||
}
|
||||
input{
|
||||
margin: 4px;
|
||||
outline: none;
|
||||
border: 1px solid #ddd;
|
||||
line-height: 24px;
|
||||
min-width: 300px;
|
||||
padding-left: 10px;
|
||||
}
|
||||
</style>
|
56
src/pages/otherPages2.vue
Normal file
56
src/pages/otherPages2.vue
Normal file
@ -0,0 +1,56 @@
|
||||
<template>
|
||||
<div class="container">
|
||||
|
||||
<!-- 这是父组件内容 -->
|
||||
<h4>子组件数据传递给父组件</h4>
|
||||
<p>方式:用自定义事件</p>
|
||||
<p class="text-center parent-tit">这是父组件</p>
|
||||
<!-- 父组件可以在使用子组件的地方直接用 v-on 来监听子组件触发的事件。 -->
|
||||
<h2 class="text-center">{{ total }}</h2>
|
||||
|
||||
|
||||
<!-- 这是子组件内容 -->
|
||||
<div class="text-center">
|
||||
<p>这是子组件</p>
|
||||
<buttonCounter v-on:increment="incrementTotal"></buttonCounter>
|
||||
<buttonCounter v-on:increment="incrementTotal"></buttonCounter>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import buttonCounter from '../components/thirdcomponent.vue'
|
||||
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
parentMsg: '子组件传递信息给父元素',
|
||||
total: 0
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
incrementTotal: function () {
|
||||
this.total += 1
|
||||
}
|
||||
},
|
||||
components: {
|
||||
buttonCounter
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.parent-tit{
|
||||
margin-top: 30px;
|
||||
}
|
||||
h4{
|
||||
font-size: 20px;
|
||||
}
|
||||
h2{
|
||||
margin: 0 0 40px;
|
||||
}
|
||||
.text-center p {
|
||||
color: #41b883;
|
||||
}
|
||||
</style>
|
@ -6,9 +6,10 @@ import VueRouter from 'vue-router'
|
||||
Vue.config.debug = true
|
||||
Vue.use(VueRouter);
|
||||
|
||||
import secondcomponent from '../pages/otherPages.vue'
|
||||
import Index from '../pages/index.vue'
|
||||
import News from '../pages/news.vue'
|
||||
import secondcomponent from '../pages/otherPages.vue'
|
||||
import thirdcomponent from '../pages/otherPages2.vue'
|
||||
|
||||
export default new VueRouter({
|
||||
mode: 'history',
|
||||
@ -25,6 +26,10 @@ export default new VueRouter({
|
||||
{
|
||||
path: '/second',
|
||||
component: secondcomponent
|
||||
},
|
||||
{
|
||||
path: '/third',
|
||||
component: thirdcomponent
|
||||
}
|
||||
]
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user