Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic set url when snds changed #14

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 14 additions & 18 deletions src/components/playquery.vue
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,6 @@ export default {
},
getUrl() {
this.shortText = "短網址產生中...";
let url = "";
for (let i = 0; i < this.snds.length; i++) {
url = url + this.snds[i].id + ",";
}
url = url.substr(0, url.length - 1);
this.$router.push({
name: "home",
query: { sids: url }
});
// get short url
let shortInput = this.$refs.shortInput;
this.$http
Expand Down Expand Up @@ -184,15 +175,6 @@ export default {
this.snds = [];
},
shareFacebook() {
let url = "";
for (let i = 0; i < this.snds.length; i++) {
url = url + this.snds[i].id + ",";
}
url = url.substr(0, url.length - 1);
this.$router.push({
name: "home",
query: { sids: url }
});
window.open(
"http://www.facebook.com/sharer/sharer.php?u=" +
encodeURIComponent(window.location.href)
Expand Down Expand Up @@ -279,6 +261,20 @@ export default {
}
}
}
},
snds: function(newVal) {
let url = "";
for (let i = 0; i < newVal.length; i++) {
url = url + newVal[i].id + ",";
}
url = url.substr(0, url.length - 1);
const routerObj = {
name: "home"
};
if (url) {
routerObj.query = { sids: url };
}
this.$router.push(routerObj);
}
}
};
Expand Down