这是我的代码:
data () {
return {
msg: '',
rgbValue: '',
newColor: {
color: this.msg
}
}
}
Run Code Online (Sandbox Code Playgroud)
此代码不起作用.我想把价值msg放在我的对象中newColor.有没有人有办法解决吗?
以下是代码的补充:
data () {
let msg = '';
return {
msg: msg,
rgbValue: '',
newColor: {
color: msg
}
}
},
components: {
HeaderComponent: require('./HeaderComponent.vue')
},
methods: {
msgFunc: function () {
colorsRef.push(this.newColor);
const app = document.querySelector('#app');
const rgbValueContainer = document.querySelector('.rgb-value');
if (this.msg[0] !== '#') {
this.msg = '#'
}
app.style.backgroundColor = this.msg
function convert(hex) {
hex = …Run Code Online (Sandbox Code Playgroud)