@@ -355,6 +355,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
import url from 'url';
|
||||||
|
import querystring from "querystring";
|
||||||
import autocomplete from '../components/autocomplete';
|
import autocomplete from '../components/autocomplete';
|
||||||
import history from "../components/history";
|
import history from "../components/history";
|
||||||
import section from "../components/section";
|
import section from "../components/section";
|
||||||
@@ -803,27 +805,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
getQueryStringFromPath() {
|
getQueryStringFromPath() {
|
||||||
let path = this.path,
|
let queryString,
|
||||||
hashIndex = path.indexOf('#'),
|
pathParsed = url.parse(this.path);
|
||||||
start = path.indexOf('?'),
|
return queryString = pathParsed.query ? pathParsed.query : '';
|
||||||
end = hashIndex !== -1 ? hashIndex : path.length,
|
|
||||||
queryString = '';
|
|
||||||
|
|
||||||
if(start !== -1) {
|
|
||||||
let sliced = path.slice(start, end);
|
|
||||||
queryString = sliced.length > 1 ? sliced : '';
|
|
||||||
}
|
|
||||||
|
|
||||||
return queryString;
|
|
||||||
},
|
},
|
||||||
queryStringToArray(queryString) {
|
queryStringToArray(queryString) {
|
||||||
return queryString.replace(/^\?/, '').split('&').filter(pair => !!pair).map(pair => {
|
let queryParsed = querystring.parse(queryString);
|
||||||
let splited = pair.replace(/#/g, '').split('=');
|
return Object.keys(queryParsed).map((key) => ({key: key, value: queryParsed[key]}))
|
||||||
return {
|
|
||||||
key: splited.shift(),
|
|
||||||
value: splited.join('=')
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
pathInputHandler() {
|
pathInputHandler() {
|
||||||
let queryString = this.getQueryStringFromPath(),
|
let queryString = this.getQueryStringFromPath(),
|
||||||
|
|||||||
Reference in New Issue
Block a user